# Agent Browser

> Use when the user needs AI-optimized headless browser automation with semantic element targeting, accessibility-first snapshots, or intelligent page understanding. Triggers on agent browser, smart browse, semantic scrape, AI browser, headless automation, accessibility tree, find by role, find by label.

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

---


# AI-Optimized Browser Automation with agent-browser

Vercel's agent-browser — a Rust-native CLI built on Playwright, optimized for AI agents with semantic locators and accessibility-first snapshots.

## Quick Start

```bash
# Install (if not already)
npm install -g agent-browser
agent-browser install  # Downloads Chrome for Testing

# Basic session
agent-browser open https://example.com
agent-browser snapshot          # Accessibility tree with element refs
agent-browser click @e2         # Click by ref
agent-browser fill @e3 "query"  # Fill input
agent-browser screenshot page.png
agent-browser close
```

## When to Use (vs playwright-cli)

Use agent-browser when:
- You need semantic element targeting (by role, label, text — not CSS selectors)
- The page structure is complex and CSS selectors are fragile
- You want accessibility-tree-based snapshots optimized for AI parsing

Use playwright-cli instead for:
- General browser automation (it's the default)
- Network interception and mocking
- Tracing and video recording
- Cookie/storage management

## Commands

### Navigation & Interaction
```bash
agent-browser open https://example.com
agent-browser click @e5
agent-browser dblclick @e7
agent-browser hover @e3
agent-browser focus @e4
agent-browser fill @e2 "user@example.com"
agent-browser type "search query"
agent-browser press Enter
agent-browser scroll down
agent-browser drag @e1 @e8
agent-browser upload ./file.pdf
```

### Semantic Locators (key differentiator)
```bash
# Find by ARIA role
agent-browser find role button click --name "Submit"
# Find by visible text
agent-browser find text "Sign In" click
# Find by label
agent-browser find label "Email" fill "test@example.com"
# Find by placeholder
agent-browser find placeholder "Search..." fill "query"
```

### Information Retrieval
```bash
agent-browser snapshot              # Full accessibility tree
agent-browser get text @e5          # Element text content
agent-browser get html @e5          # Element HTML
agent-browser get value @e3         # Input value
agent-browser get attr href @e5     # Element attribute
agent-browser screenshot page.png
agent-browser pdf output.pdf
```

### State Checks
```bash
agent-browser wait @e5              # Wait for element visible
agent-browser is visible @e5
agent-browser is enabled @e3
agent-browser is checked @e8
```

### Network & Debugging
```bash
agent-browser network route "**/*.jpg" --status=404
agent-browser network requests      # View tracked requests
agent-browser eval "document.title"
```

### Session Management
```bash
agent-browser cookies list
agent-browser cookies get session_id
agent-browser storage get theme
agent-browser close
```

## Batch Execution

Pipe JSON command arrays for reduced process startup overhead:
```bash
echo '[{"cmd":"open","args":["https://example.com"]},{"cmd":"snapshot"}]' | agent-browser batch
```

## Key Advantages

- Native Rust binary — fast startup, no Node.js runtime for daemon
- Accessibility-first snapshots — semantic tree optimized for AI agents
- Stateful sessions — browser state persists across commands
- Semantic locators — find elements by role, label, text instead of CSS

