| name | browser-use |
| description | 浏览器交互自动化:网页测试、表单填写、截图、数据提取。触发词:打开网页、填写表单、网页截图。 |
| allowed-tools | Bash(browser-use:*) |
Browser Automation with browser-use CLI
The browser-use command provides fast, persistent browser automation. It maintains browser sessions across commands, enabling complex multi-step workflows.
推荐替代方案
如果 browser-use 遇到问题,推荐使用 agent-browser(Vercel Labs)作为替代:
agent-browser open <url>
agent-browser snapshot -i
agent-browser fill @e1 "text"
agent-browser click @e2
agent-browser screenshot out.png
agent-browser eval "document.title"
agent-browser close
关键区别:
agent-browser fill 会清空后填入,keyboard type 会追加到现有值
- 使用
snapshot -i 获取交互元素,用 @e1、@e2 引用
- 每次页面变化后需要重新
snapshot 获取最新元素引用
Prerequisites
Before using this skill, browser-use must be installed and configured. Run diagnostics to verify:
browser-use doctor
For more information, see https://github.com/browser-use/browser-use/blob/main/browser_use/skill_cli/README.md
Core Workflow
- Navigate:
browser-use open <url> - Opens URL (starts browser if needed)
- Inspect:
browser-use state - Returns clickable elements with indices
- Interact: Use indices from state to interact (
browser-use click 5, browser-use input 3 "text")
- Verify:
browser-use state or browser-use screenshot to confirm actions
- Repeat: Browser stays open between commands
Browser Modes
browser-use --browser chromium open <url>
browser-use --browser chromium --headed open <url>
browser-use --browser real open <url>
browser-use --browser real --profile "Default" open <url>
browser-use --browser remote open <url>
- chromium: Fast, isolated, headless by default
- real: Uses a real Chrome binary. Without
--profile, uses a persistent but empty CLI profile at ~/.config/browseruse/profiles/cli/. With --profile "ProfileName", copies your actual Chrome profile (cookies, logins, extensions)
- remote: Cloud-hosted browser with proxy support
Essential Commands
browser-use open <url>
browser-use back
browser-use scroll down
browser-use state
browser-use screenshot
browser-use screenshot path.png
browser-use click <index>
browser-use type "text"
browser-use input <index> "text"
browser-use keys "Enter"
browser-use select <index> "option"
browser-use eval "document.title"
browser-use get text <index>
browser-use get html --selector "h1"
browser-use wait selector "h1"
browser-use wait text "Success"
browser-use sessions
browser-use close
browser-use close --all
browser-use -b remote run "task"
browser-use task status <id>
Commands
Navigation & Tabs
browser-use open <url>
browser-use back
browser-use scroll down
browser-use scroll up
browser-use scroll down --amount 1000
browser-use switch <tab>
browser-use close-tab
browser-use close-tab <tab>
Page State
browser-use state
browser-use screenshot
browser-use screenshot path.png
browser-use screenshot --full path.png
Interactions
browser-use click <index>
browser-use type "text"
browser-use input <index> "text"
browser-use keys "Enter"
browser-use keys "Control+a"
browser-use select <index> "option"
browser-use hover <index>
browser-use dblclick <index>
browser-use rightclick <index>
Use indices from browser-use state.
JavaScript & Data
browser-use eval "document.title"
browser-use get title
browser-use get html
browser-use get html --selector "h1"
browser-use get text <index>
browser-use get value <index>
browser-use get attributes <index>
browser-use get bbox <index>
Cookies
browser-use cookies get
browser-use cookies get --url <url>
browser-use cookies set <name> <value>
browser-use cookies set name val --domain .example.com --secure --http-only
browser-use cookies set name val --same-site Strict
browser-use cookies set name val --expires 1735689600
browser-use cookies clear
browser-use cookies clear --url <url>
browser-use cookies export <file>
browser-use cookies export <file> --url <url>
browser-use cookies import <file>
Wait Conditions
browser-use wait selector "h1"
browser-use wait selector ".loading" --state hidden
browser-use wait selector "#btn" --state attached
browser-use wait text "Success"
browser-use wait selector "h1" --timeout 5000
Python Execution
browser-use python "x = 42"
browser-use python "print(x)"
browser-use python "print(browser.url)"
browser-use python --vars
browser-use python --reset
browser-use python --file script.py
The Python session maintains state across commands. The browser object provides:
browser.url, browser.title, browser.html — page info
browser.goto(url), browser.back() — navigation
browser.click(index), browser.type(text), browser.input(index, text), browser.keys(keys) — interactions
browser.screenshot(path), browser.scroll(direction, amount) — visual
browser.wait(seconds), browser.extract(query) — utilities
Agent Tasks
Remote Mode Options
When using --browser remote, additional options are available:
browser-use -b remote run "task" --llm gpt-4o
browser-use -b remote run "task" --llm claude-sonnet-4-20250514
browser-use -b remote run "task" --proxy-country uk
browser-use -b remote run "task 1" --keep-alive
browser-use -b remote run "task 2" --session-id abc-123
browser-use -b remote run "task" --flash
browser-use -b remote run "task" --wait
browser-use -b remote run "task" --thinking
browser-use -b remote run "task" --no-vision
browser-use session create --profile <cloud-profile-id> --keep-alive
browser-use -b remote run "task" --session-id <session-id>
browser-use -b remote run "task" --start-url https://example.com
browser-use -b remote run "task" --allowed-domain example.com
browser-use -b remote run "task" --metadata key=value
browser-use -b remote run "task" --skill-id skill-123
browser-use -b remote run "task" --secret key=value
browser-use -b remote run "task" --structured-output '{"type":"object"}'
browser-use -b remote run "task" --judge
browser-use -b remote run "task" --judge-ground-truth "expected answer"
Task Management
browser-use task list
browser-use task list --limit 20
browser-use task list --status finished
browser-use task list --session <id>
browser-use task list --json
browser-use task status <task-id>
browser-use task status <task-id> -c
browser-use task status <task-id> -v
browser-use task status <task-id> --last 5
browser-use task status <task-id> --step 3
browser-use task status <task-id> --reverse
browser-use task stop <task-id>
browser-use task logs <task-id>
Cloud Session Management
browser-use session list
browser-use session list --limit 20
browser-use session list --status active
browser-use session list --json
browser-use session get <session-id>
browser-use session get <session-id> --json
browser-use session stop <session-id>
browser-use session stop --all
browser-use session create
browser-use session create --profile <id>
browser-use session create --proxy-country uk
browser-use session create --start-url https://example.com
browser-use session create --screen-size 1920x1080
browser-use session create --keep-alive
browser-use session create --persist-memory
browser-use session share <session-id>
browser-use session share <session-id> --delete
Tunnels
browser-use tunnel <port>
browser-use tunnel <port>
browser-use tunnel list
browser-use tunnel stop <port>
browser-use tunnel stop --all
Session Management
browser-use sessions
browser-use close
browser-use close --all
Profile Management
Local Chrome Profiles (--browser real)
browser-use -b real profile list
browser-use -b real profile cookies "Default"
Cloud Profiles (--browser remote)
browser-use -b remote profile list
browser-use -b remote profile list --page 2 --page-size 50
browser-use -b remote profile get <id>
browser-use -b remote profile create
browser-use -b remote profile create --name "My Profile"
browser-use -b remote profile update <id> --name "New"
browser-use -b remote profile delete <id>
Syncing
browser-use profile sync --from "Default" --domain github.com
browser-use profile sync --from "Default"
browser-use profile sync --from "Default" --name "Custom Name"
Server Control
browser-use server logs
Common Workflows
Exposing Local Dev Servers
Use when you have a local dev server and need a cloud browser to reach it.
Core workflow: Start dev server → create tunnel → browse the tunnel URL remotely.
npm run dev &
browser-use tunnel 3000
browser-use --browser remote open https://abc.trycloudflare.com
browser-use state
browser-use screenshot
Note: Tunnels are independent of browser sessions. They persist across browser-use close and can be managed separately. Cloudflared must be installed — run browser-use doctor to check.
Authenticated Browsing with Profiles
Use when a task requires browsing a site the user is already logged into (e.g. Gmail, GitHub, internal tools).
Core workflow: Check existing profiles → ask user which profile and browser mode → browse with that profile. Only sync cookies if no suitable profile exists.
Before browsing an authenticated site, the agent MUST:
- Ask the user whether to use real (local Chrome) or remote (cloud) browser
- List available profiles for that mode
- Ask which profile to use
- If no profile has the right cookies, offer to sync (see below)
Step 1: Check existing profiles
browser-use -b real profile list
browser-use -b remote profile list
Step 2: Browse with the chosen profile
browser-use --browser real --profile "Default" open https://github.com
browser-use --browser remote --profile abc-123 open https://github.com
The user is already authenticated — no login needed.
Note: Cloud profile cookies can expire over time. If authentication fails, re-sync cookies from the local Chrome profile.
Step 3: Syncing cookies (only if needed)
If the user wants to use a cloud browser but no cloud profile has the right cookies, sync them from a local Chrome profile.
Before syncing, the agent MUST:
- Ask which local Chrome profile to use
- Ask which domain(s) to sync — do NOT default to syncing the full profile
- Confirm before proceeding
Check what cookies a local profile has:
browser-use -b real profile cookies "Default"
Domain-specific sync (recommended):
browser-use profile sync --from "Default" --domain github.com
Full profile sync (use with caution):
browser-use profile sync --from "Default"
Only use when the user explicitly needs their entire browser state.
Fine-grained control (advanced):
browser-use --browser real --profile "Default" cookies export /tmp/cookies.json
browser-use --browser remote --profile <id> cookies import /tmp/cookies.json
Use the synced profile:
browser-use --browser remote --profile <id> open https://github.com
Running Subagents
Use cloud sessions to run autonomous browser agents in parallel.
Core workflow: Launch task(s) with run → poll with task status → collect results → clean up sessions.
- Session = Agent: Each cloud session is a browser agent with its own state
- Task = Work: Jobs given to an agent; an agent can run multiple tasks sequentially
- Session lifecycle: Once stopped, a session cannot be revived — start a new one
Launching Tasks
browser-use -b remote run "Search for AI news and summarize top 3 articles"
browser-use -b remote run "Research competitor A pricing"
browser-use -b remote run "Research competitor B pricing"
browser-use -b remote run "Research competitor C pricing"
browser-use -b remote run "Log into example.com" --keep-alive
browser-use task status task-1
browser-use -b remote run "Export settings" --session-id sess-123
Managing & Stopping
browser-use task list --status finished
browser-use task stop task-abc
browser-use session stop sess-123
browser-use session stop --all
Monitoring
Task status is designed for token efficiency. Default output is minimal — only expand when needed:
| Mode | Flag | Tokens | Use When |
|---|
| Default | (none) | Low | Polling progress |
| Compact | -c | Medium | Need full reasoning |
| Verbose | -v | High | Debugging actions |
browser-use task status <id> -c --last 5
browser-use task status <id> -v --step 10
Live view: browser-use session get <session-id> returns a live URL to watch the agent.
Detect stuck tasks: If cost/duration in task status stops increasing, the task is stuck — stop it and start a new agent.
Logs: browser-use task logs <task-id> — only available after task completes.
Global Options
| Option | Description |
|---|
--session NAME | Use named session (default: "default") |
--browser MODE | Browser mode: chromium, real, remote |
--headed | Show browser window (chromium mode) |
--profile NAME | Browser profile (local name or cloud ID). Works with open, session create, etc. — does NOT work with run (use --session-id instead) |
--json | Output as JSON |
--mcp | Run as MCP server via stdin/stdout |
Session behavior: All commands without --session use the same "default" session. The browser stays open and is reused across commands. Use --session NAME to run multiple browsers in parallel.
Tips
- Always run
browser-use state first to see available elements and their indices
- Use
--headed for debugging to see what the browser is doing
- Sessions persist — the browser stays open between commands
- Use
--json for programmatic parsing
- Python variables persist across
browser-use python commands within a session
- CLI aliases:
bu, browser, and browseruse all work identically to browser-use
Troubleshooting
Run diagnostics first:
browser-use doctor
Browser won't start?
browser-use close --all
browser-use --headed open <url>
Element not found?
browser-use state
browser-use scroll down
browser-use state
Session issues?
browser-use sessions
browser-use close --all
browser-use open <url>
Session reuse fails after task stop:
If you stop a task and try to reuse its session, the new task may get stuck at "created" status. Create a new session instead:
browser-use session create --profile <profile-id> --keep-alive
browser-use -b remote run "new task" --session-id <new-session-id>
Task stuck at "started": Check cost with task status — if not increasing, the task is stuck. View live URL with session get, then stop and start a new agent.
Sessions persist after tasks complete: Tasks finishing doesn't auto-stop sessions. Run browser-use session stop --all to clean up.
Cleanup
Always close the browser when done:
browser-use close
browser-use session stop --all
browser-use tunnel stop --all