Robocorp browser automation library
Project description
Robocorp browser library
The robocorp-browser
library helps in automating browsers by providing
convenient APIs to manage the lifecycle of playwright objects using robocorp-tasks
.
The code below reflects the basic usage of the library:
from robocorp import browser
from robocorp.tasks import task
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",
# If headless is not passed, it'll show the browser screen only if a
# debugger is attached.
headless=True,
)
# 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://<target-page.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.
password = vault.get_secret("default-account")["password"]
# Use the playwright Browser api as usual.
page.fill('//input[@ng-reflect-name="password"]', password)
page.click("input:text('Submit')")
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-1.0.2.tar.gz
.
File metadata
- Download URL: robocorp_browser-1.0.2.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.6 Linux/5.15.0-1040-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f79afcda8801435e2846bfa0b0d3758477b7c8c8e40a0cbb0e77c02637d9631a |
|
MD5 | c884bb610994d91029952ed8baafd75e |
|
BLAKE2b-256 | 7bafc19da33de05f084e1516b6c646a123e2bf870b14ee44595cf142e416cf6d |
Provenance
File details
Details for the file robocorp_browser-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: robocorp_browser-1.0.2-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.6 Linux/5.15.0-1040-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a767088e44b3d6b1e3d66963586978fe91d4add42b01f3b78aba36a290bd3ec |
|
MD5 | cc975f096ba4d7ffb207b72def99d99c |
|
BLAKE2b-256 | 87776ef258ca01a617039bcb38b2e8c3768f19a5de88ea20a082dc32f5abe2c4 |