Skip to main content
The Browser Use CLI provides fast, persistent browser automation from the command line. The CLI uses a session server architecture where the browser stays open between commands for instant response times (~50ms).

Installation

1

Install Browser Use

2

Install Chromium

Installs Chromium browser with system dependencies (Linux only).
3

Verify Installation

Checks your installation and validates dependencies.

Setup Commands

install

Installs Chromium browser with system dependencies.
  • On Linux: Installs with --with-deps flag for system dependencies
  • On macOS/Windows: Installs Chromium only (no system dependencies needed)

init

Generates template files to get started quickly.
Options:
  • --template, -t - Template name (interactive if not specified)
  • --output, -o - Output file path
  • --force, -f - Overwrite existing files
  • --list, -l - List available templates

setup

Configures browser-use for first-time use.
Options:
  • --mode - Setup mode: local, remote, or full (default: local)
  • --api-key - Browser-Use API key
  • --yes, -y - Skip interactive prompts

doctor

Validates installation and checks dependencies.
Returns health check results for:
  • Python version
  • Browser installation
  • API key configuration
  • Network connectivity

open

Navigate to a URL.
Automatically starts the browser if not already running.

back

Go back in browser history.

scroll

Scroll the page up or down.
Options:
  • direction - up or down (default: down)
  • --amount - Scroll amount in pixels (default: 500)

Inspection Commands

state

Get browser state including URL, title, and clickable elements.
Returns:
  • Current URL
  • Page title
  • List of interactive elements with indices
  • Element types (button, input, link, etc.)

screenshot

Take a screenshot of the current page.
Options:
  • path - Save path (outputs base64 if not provided)
  • --full - Capture full page instead of viewport

Interaction Commands

click

Click an element by its index from the state command.

type

Type text into the currently focused element.

input

Click an element by index, then type text into it.
Equivalent to: click 3 + type "john@example.com"

keys

Send keyboard keys or key combinations.

select

Select a dropdown option.

hover

Hover over an element.

dblclick

Double-click an element.

rightclick

Right-click an element.

Tab Management

switch

Switch to a different tab by index.

close-tab

Close a tab.

cookies get

Get all cookies or cookies for a specific URL.

cookies set

Set a cookie with options.
Options:
  • --domain - Cookie domain
  • --path - Cookie path (default: /)
  • --secure - Mark as secure cookie
  • --http-only - Mark as HTTP-only
  • --same-site - SameSite attribute: Strict, Lax, or None
  • --expires - Expiration timestamp

cookies clear

Clear cookies.

cookies export

Export cookies to a JSON file.

cookies import

Import cookies from a JSON file.

Wait Commands

wait selector

Wait for a CSS selector to appear or disappear.
Options:
  • --timeout - Timeout in milliseconds (default: 30000)
  • --state - Element state: attached, detached, visible, or hidden (default: visible)

wait text

Wait for text to appear on the page.

Information Retrieval

get title

Get the page title.

get html

Get page HTML.

get text

Get text content of an element.

get value

Get value of an input element.

get attributes

Get all attributes of an element.

get bbox

Get element bounding box (x, y, width, height).

JavaScript & Data Extraction

eval

Execute custom JavaScript code.

extract

Extract data using LLM (requires API key).

Python Execution

Execute Python code with persistent namespace.
The browser object is available in the Python namespace for browser interactions.

Agent Tasks

Run AI-powered browser automation tasks.

Local Mode

Options:
  • --max-steps - Maximum steps
  • --llm - LLM model (e.g., gpt-4o, claude-sonnet-4-20250514)
Requires: OPENAI_API_KEY, ANTHROPIC_API_KEY, or other LLM provider API key

Remote Mode (Cloud)

Cloud Options:
  • --session-id - Reuse existing cloud session
  • --proxy-country - Proxy country code (e.g., us, uk, gb)
  • --stream - Stream output in real-time
  • --wait - Wait for completion (default: async)
  • --flash - Enable fast mode
  • --keep-alive - Keep session alive after task
  • --thinking - Enable extended reasoning
  • --vision - Enable vision (default)
  • --no-vision - Disable vision
  • --profile - Use cloud profile ID
  • --start-url - Start from specific URL
  • --allowed-domain - Restrict navigation (repeatable)
  • --metadata - Task metadata as KEY=VALUE (repeatable)
  • --secret - Task secrets as KEY=VALUE (repeatable)
  • --skill-id - Enable skill IDs (repeatable)
  • --structured-output - JSON schema for structured output
  • --judge - Enable judge mode
  • --judge-ground-truth - Expected answer for evaluation
Requires: BROWSER_USE_API_KEY

Task Management (Remote)

task list

List recent cloud tasks.
Options:
  • --limit - Maximum tasks to list (default: 10)
  • --status - Filter by status: running, finished, stopped, failed
  • --session - Filter by session ID

task status

Get task status and details.

task stop

Stop a running task.

task logs

Get task execution logs.

Cloud Session Management

session list

List cloud sessions.
Options:
  • --limit - Maximum sessions (default: 10)
  • --status - Filter by status: active, stopped

session get

Get session details including live URL.

session stop

Stop cloud session(s).

session create

Create a new cloud session.
Options:
  • --profile - Cloud profile ID
  • --proxy-country - Proxy country code
  • --start-url - Initial URL
  • --screen-size - Screen size (e.g., 1920x1080)
  • --keep-alive - Keep session alive
  • --persist-memory - Persist memory between tasks

session share

Create or delete public share URL.

Tunnels

Expose local dev servers via Cloudflare tunnels.

tunnel start

Returns a public URL like https://abc.trycloudflare.com

tunnel list

List active tunnels.

tunnel stop

Stop tunnel(s).

Profile Management

Local Profiles (-b real)

Cloud Profiles (-b remote)

Local Session Management

sessions

List active local sessions.

close

Close browser session.

server commands

Manage the session server.

Global Options

These options work with any command:
  • --session NAME - Use named session (default: default)
  • --browser MODE - Browser mode: chromium, real, or remote
  • --headed - Show browser window (default: headless)
  • --profile NAME - Browser profile (local name or cloud ID)
  • --json - Output as JSON
  • --api-key KEY - Override API key
  • --mcp - Run as MCP server via stdin/stdout

Browser Modes

Chromium (Default)

Headless Chromium browser.

Real Browser

Use your actual Chrome browser with existing logins.

Remote (Cloud)

Cloud browser with anti-detection features.
Requires: BROWSER_USE_API_KEY

Persistent Sessions

The CLI uses a session server architecture where the browser stays open between commands:

Multiple Sessions

Run multiple browsers in parallel:

Examples

Form Filling

Data Extraction

Cloud Agent with Session Reuse

Troubleshooting

Session server won’t start

View server logs

Check installation

How It Works

The CLI uses a background session server:
  1. First command starts a server (browser stays open)
  2. Commands communicate via Unix socket (TCP on Windows)
  3. ~50ms latency instead of waiting for browser startup
  4. Server auto-starts when needed, stops with browser-use server stop