Browser Use 2.0 — Fast CDP-Based Browser Automation
Browser Use 2.0 CLI — direct CDP connection to Chrome, 2x speed, half the cost.
Quick Start
# Install
pip3 install browser-use
# Basic session
browser-use open https://example.com
browser-use state # See clickable elements with indices
browser-use click 5 # Click element by index
browser-use type "Hello" # Type text
browser-use screenshot page.png
browser-use close
When to Use
Use browser-use when:
- You need to connect to an already-running Chrome instance via CDP
- Speed and cost efficiency are priorities
- You want direct CDP protocol access
Use playwright-cli instead for:
- General browser automation (default choice)
- Complex element targeting with refs
- Tracing, video recording, network mocking
Connect to Running Chrome
# Launch Chrome with remote debugging
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222
# Connect browser-use to it
browser-use connect --cdp-url http://localhost:9222
This is the key advantage — connect to a Chrome session where the user is already logged in, preserving all auth state.
Commands
Core
browser-use open https://example.com
browser-use state # List interactive elements
browser-use click <index> # Click by element index
browser-use type "text" # Type text
browser-use press Enter # Keyboard input
browser-use screenshot [filename]
browser-use close
CDP Connection
browser-use connect --cdp-url http://localhost:9222
browser-use connect --cdp-url ws://localhost:9222/devtools/browser/<id>
State Inspection
browser-use state # All interactive elements
browser-use state --full # Full page state
Python API (for scripts)
from browser_use import Agent, Browser, BrowserConfig
# Connect to existing Chrome
config = BrowserConfig(cdp_url="http://localhost:9222")
browser = Browser(config=config)
# Or launch new browser
browser = Browser()
agent = Agent(
task="Find the latest news about AI",
llm=your_llm,
browser=browser,
)
result = await agent.run()
Environment Variables
BROWSER_USE_API_KEY— Optional, for cloud stealth browsers- LLM provider keys (if using Agent mode):
OPENAI_API_KEY,ANTHROPIC_API_KEY, etc.
Integration with api-harvester
browser-use's CDP connection is useful for api-harvester Mode B:
- Connect to user's logged-in Chrome session
- Capture network traffic while user operates the site
- Extract auth tokens from the live session