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 (meant to be used with robocorp-tasks
).
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
robocorp_browser-2.2.1.tar.gz
(11.2 kB
view details)
Built Distribution
File details
Details for the file robocorp_browser-2.2.1.tar.gz
.
File metadata
- Download URL: robocorp_browser-2.2.1.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.10.12 Linux/6.2.0-1015-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4d4631b0cbf2a0dbae5a6efe6e07bbc0d0d84a20a2c977629dc990c736f7cee |
|
MD5 | 432cccbe13107bd574c4ba10c59c757a |
|
BLAKE2b-256 | 32f9dc272c0cea2ac9675b81e090f5ca80e2559fde4ea75bc9a4996d5266fb1c |
Provenance
File details
Details for the file robocorp_browser-2.2.1-py3-none-any.whl
.
File metadata
- Download URL: robocorp_browser-2.2.1-py3-none-any.whl
- Upload date:
- Size: 13.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.10.12 Linux/6.2.0-1015-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2170001f33d981d900d18301eaa6abf2b1dd4e1b623a991a6807d2a49ff4614 |
|
MD5 | 6d1f0e2e7047248701fb3075f56699c8 |
|
BLAKE2b-256 | 5d7ea731f2e4c27102e6c49be9c78285fb81717f440caaef40b2b4428efb757e |