Implementation:MarketSquare Robotframework browser Rfbrowser Install
| Knowledge Sources | |
|---|---|
| Domains | Browser_Automation, Installation |
| Last Updated | 2026-02-12 04:00 GMT |
Overview
Concrete tool for installing Playwright browser binaries provided by the robotframework-browser library's rfbrowser install CLI command.
Description
The install function is a Click CLI command registered under the rfbrowser command group. It installs Playwright browser binaries by delegating to the execute_npx_playwright("install", ...) method on a Browser library instance.
The function performs the following steps:
- Parse the browser argument: If a browser name is provided, it is converted to an
InstallableBrowserenum value for validation - Collect installation flags: Boolean flags (
--with-deps,--dry-run,--list,--force,--only-shell,--no-shell) are mapped to their correspondingInstallationOptionsenum values - Ensure browser path: Calls
ensure_playwright_browsers_path()to setPLAYWRIGHT_BROWSERS_PATHif not already configured - Get library instance: Creates a configured Browser library instance via
get_browser_lib() - Execute installation: Passes the collected options and browser name to
execute_npx_playwright("install", *options)
The installation options are dynamically added to the Click command via a loop over the InstallationOptions enum (lines 516-520), which registers each option as a Click flag with its corresponding help text from InstallationOptionsHelp.
This command is specifically designed for use with the BrowserBatteries installation path, where Node.js dependencies are bundled and only browser binaries need to be downloaded separately. Users who installed via the standard path should use rfbrowser init instead.
Usage
Use this command after installing both robotframework-browser and robotframework-browser-batteries to download the browser binaries needed for test execution. Do not combine this with rfbrowser init.
Code Reference
Source Location
- Repository: robotframework-browser
- File:
Browser/entry/__main__.py - Lines: 482-520
Signature
@cli.command()
@click.argument(
"browser",
type=click.Choice([b.value for b in InstallableBrowser]),
required=False,
default=None,
)
def install(browser: str | None = None, **flags):
Import
# This is a CLI command, typically invoked from the command line:
# rfbrowser install [BROWSER] [OPTIONS]
# For programmatic use:
from Browser.entry.__main__ import install
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| browser | None | No | Name of a specific browser to install; one of: chromium, firefox, webkit, chromium-headless-shell, chromium-tip-of-tree-headless-shell, chrome, chrome-beta, msedge, msedge-beta, msedge-dev. If omitted, all default browsers are installed.
|
| --with-deps | bool (flag) |
No | Install system dependencies for browsers (fonts, shared libraries) |
| --dry-run | bool (flag) |
No | Print what would be installed without actually downloading |
| --list | bool (flag) |
No | List all browsers from all Playwright installations |
| --force | bool (flag) |
No | Force reinstall of stable browser channels |
| --only-shell | bool (flag) |
No | Only install headless shell when installing chromium |
| --no-shell | bool (flag) |
No | Do not install chromium headless shell |
Outputs
| Name | Type | Description |
|---|---|---|
| return | None |
The function produces no return value |
| side effects | filesystem | Browser binaries are downloaded and stored in the directory specified by PLAYWRIGHT_BROWSERS_PATH
|
| stdout | text | Installation progress and status messages are printed to stdout |
Usage Examples
Basic Example
# Install all default Playwright browsers
rfbrowser install
# Install only chromium
rfbrowser install chromium
# Install firefox with system dependencies
rfbrowser install --with-deps firefox
# List currently installed browsers
rfbrowser install --list
# Dry run to see what would be installed
rfbrowser install --dry-run
# Force reinstall of chromium
rfbrowser install --force chromium
# Install chromium headless shell only
rfbrowser install --only-shell chromium
BrowserBatteries Workflow
# Step 1: Install Python packages (BrowserBatteries bundles Node.js deps)
pip install robotframework-browser[bb]
# Step 2: Install browser binaries (no rfbrowser init needed)
rfbrowser install
# Step 3: Verify
rfbrowser --version
Programmatic Usage
from Browser.entry.constant import ensure_playwright_browsers_path, get_browser_lib
# Ensure PLAYWRIGHT_BROWSERS_PATH is configured
ensure_playwright_browsers_path()
# Get a configured Browser library instance
browser_lib = get_browser_lib()
# Install chromium browser binary
browser_lib.execute_npx_playwright("install", "chromium")