# Browser Use

> Use when the user needs fast cost-efficient browser automation via CDP direct connection, connecting to an already-running Chrome instance, or using Browser Use 2.0 CLI. Triggers on browser use, CDP connect, connect to running chrome, fast browser automation, browser-use CLI, direct CDP, cost efficient browsing.

- Skill: `ralfnick/browser-use` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add ralfnick/browser-use`
- Raw SKILL.md: https://api.skillmd.com/api/skills/ralfnick/browser-use/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: RalfNick (https://skillmd.com/u/ralfnick)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/ralfnick/browser-use

---


# 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

```bash
# 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

```bash
# 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
```bash
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
```bash
browser-use connect --cdp-url http://localhost:9222
browser-use connect --cdp-url ws://localhost:9222/devtools/browser/<id>
```

### State Inspection
```bash
browser-use state                    # All interactive elements
browser-use state --full             # Full page state
```

## Python API (for scripts)

```python
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:
1. Connect to user's logged-in Chrome session
2. Capture network traffic while user operates the site
3. Extract auth tokens from the live session

