Robocorp browser automation library
Project description
robocorp-browser
The robocorp-browser
is a wrapper for the Playwright
project, with quality-of-life improvements such as automatic lifecycle management
for Playwright objects.
Getting started
from robocorp.tasks import task
from robocorp import browser
from robocorp import vault
@task
def browser_automate():
# Configure may be used to set the basic robocorp.browser settings.
# It must be called prior to calling APIs which create playwright objects.
browser.configure(
# Note: screenshot="only-on-failure" is actually the default.
# If the browser_automate() function finishes with an exception it will
# make a screenshot and embed it into the logs.
screenshot="only-on-failure",
# By default headless is False unless running in a Linux container
# without a DISPLAY/WAYLAND_DISPLAY environment variable, but it
# can also be manually specified.
headless=True,
# Interactions may be run in slow-motion (given in milliseconds).
slowmo=100,
)
# browser.goto() may be used as a shortcut to get the current page and
# go to some url (it may create the browser if still not created).
browser.goto("https://example.com>")
login()
def login():
# APIs in robocorp.browser return the same browser instance, which is
# automatically closed when the task finishes.
page = browser.page()
# robocorp.vault is recommended for managing secrets.
account = vault.get_secret("default-account")
# Use the playwright Browser api as usual.
page.fill('//input[@ng-reflect-name="password"]', account["password"])
page.click("input:text('Submit')")
Guides
API Reference
Information on specific functions or classes: robocorp.browser
Changelog
A list of releases and corresponding changes can be found in the changelog.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file robocorp_browser-2.1.0.tar.gz
.
File metadata
- Download URL: robocorp_browser-2.1.0.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.6 Linux/5.15.0-1042-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8ec8c669815ef41ad9434caeda37643282e39f975b1970ca721a13aa264cc4b |
|
MD5 | aa678a85f46c7ee413bd18b8b803fe66 |
|
BLAKE2b-256 | b669bd0c54b42766b29446f025fe5eaf034c8bab1d156173b54c5d525139887b |
Provenance
File details
Details for the file robocorp_browser-2.1.0-py3-none-any.whl
.
File metadata
- Download URL: robocorp_browser-2.1.0-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.6 Linux/5.15.0-1042-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a6465dde34734d01e8be2ad658977f28a6e3db822cb64ff1baf8d2e83ac0a63 |
|
MD5 | 000f8bae493ed0b60d68b50b7d729dce |
|
BLAKE2b-256 | bf8c6480f981b49380cf10e8e2cc1f0e6ed398269ff2ae00477247883e1a56a3 |