Skip to main content

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",
        
        # 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|False,
        
        # 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://<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


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.0.1.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

robocorp_browser-2.0.1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file robocorp_browser-2.0.1.tar.gz.

File metadata

  • Download URL: robocorp_browser-2.0.1.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.6 Linux/5.15.0-1041-azure

File hashes

Hashes for robocorp_browser-2.0.1.tar.gz
Algorithm Hash digest
SHA256 22d2b4696d09ce3d0039a2157aeeceb22c1d9910591ab0574a763dfdd35b2f68
MD5 ac8f6d3a7fe777a6d86cd4fe2d2c727e
BLAKE2b-256 2efac3f3e0f2ae4c4b29f974f12c787e4afa9dc0057b0bb14b08a59fc5706acc

See more details on using hashes here.

Provenance

File details

Details for the file robocorp_browser-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: robocorp_browser-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.6 Linux/5.15.0-1041-azure

File hashes

Hashes for robocorp_browser-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 af9b5f2d24a9e91762e65bf46d319916a97ca3e7a2f6511340ef5360e918d105
MD5 e9645fdcf4103cc5685de59732be3382
BLAKE2b-256 339bcd31e2a2e2aa5ba4c11290367d56df6d14063284b31cb770bfe9fc3bbfc0

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page