Skip to main content

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).

Usage

robocorp-browser

👉 Check that you have added the dependency in your configuration, this library is not apart of the robocorp -package.

  • conda.yaml for an automation Task Packages
  • action-package.yaml for an automation Action Packages
  • requirements.txt, pyproject.toml etc. for the rest
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')")

🚀 You can also get started with our template

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


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

Uploaded Source

Built Distribution

robocorp_browser-2.3.1-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: robocorp_browser-2.3.1.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.10.12 Linux/6.5.0-1016-azure

File hashes

Hashes for robocorp_browser-2.3.1.tar.gz
Algorithm Hash digest
SHA256 670650137652d6f356dc015301fd2f6d7eb8f2000524ff2c7fd10213b14ab972
MD5 7761377230abdffbaeb686b40a215af7
BLAKE2b-256 9c9759b94c45135fee3183e1c36cd5378ff0dd56530edf92f937447feb84df49

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: robocorp_browser-2.3.1-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.10.12 Linux/6.5.0-1016-azure

File hashes

Hashes for robocorp_browser-2.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7bca73a3bdd45dda45df6f7ca9190129127933145ecd1e80e9c235b6d0ddf477
MD5 2e0530059ac3b5659cba6a0153521125
BLAKE2b-256 7241a9df11f8b5c1aa6ab26c894c070ea5207436bb2c5eccb9a8766220f74dea

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