Install & Compatibility
Where this runs
tested against v2.4.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
build_error
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 3.9s · import 0.363s · 163MB
161MB installed
● package 161MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
browser
✓ from robocorp import browser
task
✓ from robocorp.tasks import task
For defining automation tasks, typically used with robocorp-browser.
vault
✓ from robocorp import vault
For accessing secrets, commonly used with robocorp-browser automation for logins.
This quickstart demonstrates how to initialize the browser, configure its behavior (like headless mode and slow motion), navigate to a URL, and interact with elements using the underlying Playwright API. It also shows how to integrate with `robocorp-tasks` and `robocorp-vault` for defining tasks and managing secrets.
import os
from robocorp import browser
from robocorp.tasks import task
from robocorp import vault # For secret management example
@task
def automate_browser_example():
"""Start a browser, navigate, and interact with a page."""
# Configure browser settings (optional)
browser.configure(
browser_engine="chromium",
headless=True, # Set to False to see the browser UI
slowmo=100, # Run interactions in slow motion (milliseconds)
screenshot="only-on-failure", # Capture screenshot on error
)
# Get a secret (example: login credentials)
# In a real scenario, configure 'default-account' in Robocorp Vault
# For quickstart, we use environment variables as a fallback
username = os.environ.get('TEST_USERNAME', 'user')
password = os.environ.get('TEST_PASSWORD', 'pass')
try:
account = vault.get_secret("default-account")
username = account["username"]
password = account["password"]
except Exception:
print("Warning: Could not get secret 'default-account'. Using environment variables or defaults.")
# Navigate to a page (this will automatically launch the browser if not already open)
page = browser.goto("https://www.example.com/login") # Replace with a real login page
# Interact with elements using Playwright API
# Example: fill login form (replace with actual selectors)
# page.fill("#username_field", username)
# page.fill("#password_field", password)
# page.click("#login_button")
# Perform some action, e.g., take a screenshot
browser.screenshot(page=page, path="output/example_screenshot.png")
print(f"Navigated to {page.url} and took a screenshot.")
# The browser instance is automatically closed when the task finishes.
Errors
Common errors & fixes
BrowserNotFoundError: Failed to start a browser: - chromium: Could not get browser version.
The underlying Playwright browser executable is not installed or cannot be found, or there's an incompatibility with the system environment.
fixRun `playwright install` in your environment to ensure the necessary browser binaries are downloaded. Alternatively, configure `browser.configure(install=True)` which attempts to download if the browser fails to launch. Ensure your system meets Playwright's requirements.
RuntimeError: If persistent_context_directory is specified in the configuration and this method is called a RuntimeError is raised (as in this case this API is not applicable as the browser and the context must be created at once and the browser can't be reused for the session).
You are attempting to call `browser.browser()` while `persistent_context_directory` has been set in `browser.configure()`. The `browser.browser()` method is incompatible with persistent contexts.
fixInstead of `browser.browser()`, use `browser.page()` or `browser.context()` after calling `browser.configure(persistent_context_directory='...')`. These methods correctly manage the browser and context with the persistent directory.
UnicodeEncodeError: 'charmap' codec can't encode character '\u2013' in position ...
This typically occurs on Windows systems when the default console code page is not set to a Unicode-compatible encoding, leading to issues with non-ASCII characters in logs or outputs.
fixEnsure your Windows system's code page is set to Unicode (e.g., UTF-8). This can often be resolved by changing system locale settings or running scripts with `chcp 65001` (though robust solutions involve proper encoding handling within Python or environment configuration).
Upgrade
Version history
2.4.0latest on PyPI · released Mar 13, 2026
Audit
Dependencies
playwrightrequiredRobocorp Browser is a wrapper around Playwright. It handles Playwright browser installation automatically by default, but Playwright itself is the underlying engine.
robocorp-tasksoptionalCommonly used in conjunction with robocorp-browser for defining and orchestrating automation tasks within the Robocorp platform.
robocorp-vaultoptionalOften used for securely managing credentials and secrets in browser automation scripts.