Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:MarketSquare Robotframework browser Rfbrowser Install

From Leeroopedia
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:

  1. Parse the browser argument: If a browser name is provided, it is converted to an InstallableBrowser enum value for validation
  2. Collect installation flags: Boolean flags (--with-deps, --dry-run, --list, --force, --only-shell, --no-shell) are mapped to their corresponding InstallationOptions enum values
  3. Ensure browser path: Calls ensure_playwright_browsers_path() to set PLAYWRIGHT_BROWSERS_PATH if not already configured
  4. Get library instance: Creates a configured Browser library instance via get_browser_lib()
  5. 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

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

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment