| name | browser-use |
| description | 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. |
| 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.
Quick Start
browser-use open https://example.com
browser-use state
browser-use click 5
browser-use type "Hello World"
browser-use screenshot
browser-use close
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 remote open <url>
- chromium: Fast, isolated, headless by default
- real: Uses your Chrome with cookies, extensions, logged-in sessions
- remote: Cloud-hosted browser with proxy support (requires BROWSER_USE_API_KEY)
Commands
Navigation
browser-use open <url>
browser-use back
browser-use scroll down
browser-use scroll up
Page State
browser-use state
browser-use screenshot
browser-use screenshot path.png
browser-use screenshot --full path.png
Interactions (use indices from browser-use state)
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"
Tab Management
browser-use switch <tab>
browser-use close-tab
browser-use close-tab <tab>
JavaScript & Data
browser-use eval "document.title"
browser-use extract "all product prices"
Python Execution (Persistent Session)
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 - Current page URL
browser.title - Page title
browser.goto(url) - Navigate
browser.click(index) - Click element
browser.type(text) - Type text
browser.screenshot(path) - Take screenshot
browser.scroll() - Scroll page
browser.html - Get page HTML
Agent Tasks (Requires API Key)
browser-use run "Fill the contact form with test data"
browser-use run "Extract all product prices" --max-steps 50
Agent tasks use an LLM to autonomously complete complex browser tasks. Requires BROWSER_USE_API_KEY or configured LLM API key (OPENAI_API_KEY, ANTHROPIC_API_KEY, etc).
Session Management
browser-use sessions
browser-use close
browser-use close --all
Server Control
browser-use server status
browser-use server stop
browser-use server logs
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 | Chrome profile (real mode only) |
--json | Output as JSON |
--api-key KEY | Override API key |
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.
Examples
Form Submission
browser-use open https://example.com/contact
browser-use state
browser-use input 0 "John Doe"
browser-use input 1 "john@example.com"
browser-use input 2 "Hello, this is a test message."
browser-use click 3
browser-use state
Multi-Session Workflows
browser-use --session work open https://work.example.com
browser-use --session personal open https://personal.example.com
browser-use --session work state
browser-use --session personal state
browser-use close --all
Data Extraction with Python
browser-use open https://example.com/products
browser-use python "
products = []
for i in range(20):
browser.scroll('down')
browser.screenshot('products.png')
"
browser-use python "print(f'Captured {len(products)} products')"
Using Real Browser (Logged-In Sessions)
browser-use --browser real open https://gmail.com
browser-use state
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 parsing output programmatically
- Python variables persist across
browser-use python commands within a session
- Real browser mode preserves your login sessions and extensions
Troubleshooting
Browser won't start?
browser-use server stop
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>
Cleanup
Always close the browser when done. Run this after completing browser automation:
browser-use close