Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Persistent browser automation CLI supporting headless Chromium, visible Chrome, real Chrome profiles, and cloud browsers.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
SKILL.md
1---2name: browser-use3description: Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, or extract information from web pages.4allowed-tools: Bash(browser-use:*)5---67# Browser Automation with browser-use CLI89The `browser-use` command provides fast, persistent browser automation. A background daemon keeps the browser open across commands, giving ~50ms latency per call.1011## Prerequisites1213```bash14browser-use doctor # Verify installation15```1617For setup details, see https://github.com/browser-use/browser-use/blob/main/browser_use/skill_cli/README.md1819## Core Workflow20211. **Navigate**: `browser-use open <url>` — launches headless browser and opens page222. **Inspect**: `browser-use state` — returns clickable elements with indices233. **Interact**: use indices from state (`browser-use click 5`, `browser-use input 3 "text"`)244. **Verify**: `browser-use state` or `browser-use screenshot` to confirm255. **Repeat**: browser stays open between commands2627If a command fails, run `browser-use close` first to clear any broken session, then retry.2829To use the user's existing Chrome (preserves logins/cookies): run `browser-use connect` first.30To use a cloud browser instead: run `browser-use cloud connect` first.31After either, commands work the same way.3233### If `browser-use connect` fails3435When `browser-use connect` cannot find a running Chrome with remote debugging, prompt the user with two options:36371. **Use their real Chrome browser** — they need to enable remote debugging first:38- Open `chrome://inspect/#remote-debugging` in Chrome, or relaunch Chrome with `--remote-debugging-port=9222`39- Then retry `browser-use connect`402. **Use managed Chromium with their Chrome profile** — no Chrome setup needed:41- Run `browser-use profile list` to show available profiles42- Ask which profile they want, then use `browser-use --profile "ProfileName" open <url>`43- This launches a separate Chromium instance with their profile data (cookies, logins, extensions)4445Let the user choose — don't assume one path over the other.4647## Browser Modes4849```bash50browser-use open <url> # Default: headless Chromium (no setup needed)51browser-use --headed open <url> # Visible window (for debugging)52browser-use connect # Connect to user's Chrome (preserves logins/cookies)53browser-use cloud connect # Cloud browser (zero-config, requires API key)54browser-use --profile "Default" open <url> # Real Chrome with specific profile55```5657After `connect` or `cloud connect`, all subsequent commands go to that browser — no extra flags needed.5859## Commands6061```bash62# Navigation63browser-use open <url> # Navigate to URL64browser-use back # Go back in history65browser-use scroll down # Scroll down (--amount N for pixels)66browser-use scroll up # Scroll up67browser-use tab list # List all tabs68browser-use tab new [url] # Open a new tab (blank or with URL)69browser-use tab switch <index> # Switch to tab by index70browser-use tab close <index> [index...] # Close one or more tabs7172# Page State — always run state first to get element indices73browser-use state # URL, title, clickable elements with indices74browser-use screenshot [path.png] # Screenshot (base64 if no path, --full for full page)7576# Interactions — use indices from state77browser-use click <index> # Click element by index78browser-use click <x> <y> # Click at pixel coordinates79browser-use type "text" # Type into focused element80browser-use input <index> "text" # Click element, clear existing text, then type81browser-use input <index> "" # Clear a field without typing new text82browser-use keys "Enter" # Send keyboard keys (also "Control+a", etc.)83browser-use select <index> "option" # Select dropdown option84browser-use upload <index> <path> # Upload file to file input85browser-use hover <index> # Hover over element86browser-use dblclick <index> # Double-click element87browser-use rightclick <index> # Right-click element8889# Data Extraction90browser-use eval "js code" # Execute JavaScript, return result91browser-use get title # Page title92browser-use get html [--selector "h1"] # Page HTML (or scoped to selector)93browser-use get text <index> # Element text content94browser-use get value <index> # Input/textarea value95browser-use get attributes <index> # Element attributes96browser-use get bbox <index> # Bounding box (x, y, width, height)9798# Wait99browser-use wait selector "css" # Wait for element (--state visible|hidden|attached|detached, --timeout ms)100browser-use wait text "text" # Wait for text to appear101102# Cookies103browser-use cookies get [--url <url>] # Get cookies (optionally filtered)104browser-use cookies set <name> <value> # Set cookie (--domain, --secure, --http-only, --same-site, --expires)105browser-use cookies clear [--url <url>] # Clear cookies106browser-use cookies export <file> # Export to JSON107browser-use cookies import <file> # Import from JSON108109# Session110browser-use close # Close browser and stop daemon111browser-use sessions # List active sessions112browser-use close --all # Close all sessions113```114115For advanced browser control (CDP, device emulation, tab activation), see `references/cdp-python.md`.116117## Cloud API118119```bash120browser-use cloud connect # Provision cloud browser and connect (zero-config)121browser-use cloud login <api-key> # Save API key (or set BROWSER_USE_API_KEY)122browser-use cloud logout # Remove API key123browser-use cloud v2 GET /browsers # REST passthrough (v2 or v3)124browser-use cloud v2 POST /tasks '{"task":"...","url":"..."}'125browser-use cloud v2 poll <task-id> # Poll task until done126browser-use cloud v2 --help # Show API endpoints127```128129`cloud connect` provisions a cloud browser with a persistent profile (auto-created on first use), connects via CDP, and prints a live URL. `browser-use close` disconnects AND stops the cloud browser. For custom browser settings (proxy, timeout, specific profile), use `cloud v2 POST /browsers` directly with the desired parameters.130131### Agent Self-Registration132133Only use this if you don't already have an API key (check `browser-use doctor` to see if api_key is set). If already logged in, skip this entirely.1341351. `browser-use cloud signup` — get a challenge1362. Solve the challenge1373. `browser-use cloud signup --verify <challenge-id> <answer>` — verify and save API key1384. `browser-use cloud signup --claim` — generate URL for a human to claim the account139140## Tunnels141142```bash143browser-use tunnel <port> # Start Cloudflare tunnel (idempotent)144browser-use tunnel list # Show active tunnels145browser-use tunnel stop <port> # Stop tunnel146browser-use tunnel stop --all # Stop all tunnels147```148149## Profile Management150151```bash152browser-use profile list # List detected browsers and profiles153browser-use profile sync --all # Sync profiles to cloud154browser-use profile update # Download/update profile-use binary155```156157## Command Chaining158159Commands can be chained with `&&`. The browser persists via the daemon, so chaining is safe and efficient.160161```bash162browser-use open https://example.com && browser-use state163browser-use input 5 "[email protected]" && browser-use input 6 "password" && browser-use click 7164```165166Chain when you don't need intermediate output. Run separately when you need to parse `state` to discover indices first.167168## Common Workflows169170### Authenticated Browsing171172When a task requires an authenticated site (Gmail, GitHub, internal tools), use Chrome profiles:173174```bash175browser-use profile list # Check available profiles176# Ask the user which profile to use, then:177browser-use --profile "Default" open https://github.com # Already logged in178```179180### Exposing Local Dev Servers181182```bash183browser-use tunnel 3000 # → https://abc.trycloudflare.com184browser-use open https://abc.trycloudflare.com # Browse the tunnel185```186187## Multiple Browsers188189For subagent workflows or running multiple browsers in parallel, use `--session NAME`. Each session gets its own browser. See `references/multi-session.md`.190191## Configuration192193```bash194browser-use config list # Show all config values195browser-use config set cloud_connect_proxy jp # Set a value196browser-use config get cloud_connect_proxy # Get a value197browser-use config unset cloud_connect_timeout # Remove a value198browser-use doctor # Shows config + diagnostics199browser-use setup # Interactive post-install setup200```201202Config stored in `~/.browser-use/config.json`.203204## Global Options205206| Option | Description |207|--------|-------------|208| `--headed` | Show browser window |209| `--profile [NAME]` | Use real Chrome (bare `--profile` uses "Default") |210| `--cdp-url <url>` | Connect via CDP URL (`http://` or `ws://`) |211| `--session NAME` | Target a named session (default: "default") |212| `--json` | Output as JSON |213| `--mcp` | Run as MCP server via stdin/stdout |214215## Tips2162171. **Always run `state` first** to see available elements and their indices2182. **Use `--headed` for debugging** to see what the browser is doing2193. **Sessions persist** — browser stays open between commands2204. **CLI aliases**: `bu`, `browser`, and `browseruse` all work2215. **If commands fail**, run `browser-use close` first, then retry222223## Troubleshooting224225- **Browser won't start?** `browser-use close` then `browser-use --headed open <url>`226- **Element not found?** `browser-use scroll down` then `browser-use state`227- **Run diagnostics:** `browser-use doctor`228229## Cleanup230231```bash232browser-use close # Close browser session233browser-use tunnel stop --all # Stop tunnels (if any)234```235