| name | agent-browser |
| description | Browser automation for testing and verification. Use when you need to interact with web UIs, verify visual changes, fill forms, or capture screenshots. |
Agent Browser Skill
Fast browser automation CLI for AI agents. Use this to verify web UI changes, test interactions, and capture screenshots.
When to Use
- Verify visual changes after modifying frontend code
- Test form interactions and user flows
- Capture screenshots for documentation or debugging
- Inspect rendered HTML/accessibility tree
- Debug why something isn't working in the browser
Core Workflow
1. Open a URL
agent-browser open http://localhost:4321/
2. Take a Snapshot
The snapshot command returns an accessibility tree with refs (@e1, @e2, etc.) that you can use for interactions:
agent-browser snapshot -i
agent-browser snapshot -c
agent-browser snapshot -i -c
3. Interact Using Refs
Use the @ref values from the snapshot to interact with elements:
agent-browser click @e5
agent-browser fill @e3 "hello"
agent-browser type @e3 "world"
agent-browser select @e7 "option"
agent-browser check @e9
4. Screenshot
agent-browser screenshot
agent-browser screenshot --full
agent-browser screenshot output.png
ALWAYS check the image size before attempting to load. If it is larger than 2MB, process it using a tool such as sips or ImageMagick to reduce the size. Large files cannot be loaded by your tools.
Common Patterns
Form Verification
agent-browser open http://localhost:4321/_emdash/api/setup/dev-bypass?redirect=/_emdash/admin/content/posts/new
agent-browser snapshot -i
agent-browser fill @e3 "Test Title"
agent-browser fill @e5 "Test content here"
agent-browser click @e7
Get Element Info
agent-browser get text @e1
agent-browser get html @e1
agent-browser get value @e2
agent-browser get url
agent-browser get title
agent-browser get count "button"
Check Element State
agent-browser is visible @e1
agent-browser is enabled @e2
agent-browser is checked @e3
Find by Role/Label
agent-browser find role button click --name "Submit"
agent-browser find label "Email" fill "test@example.com"
agent-browser find placeholder "Search..." type "query"
Sessions
Sessions keep browser state (cookies, storage) between commands:
agent-browser --session mytest open http://localhost:4321
agent-browser --session mytest snapshot -i
export AGENT_BROWSER_SESSION=mytest
agent-browser open http://localhost:3000
Useful Options
| Option | Description |
|---|
--session <name> | Isolated browser session |
--headed | Show browser window (not headless) |
--json | JSON output for programmatic use |
--full | Full page screenshot |
-i | Snapshot: interactive elements only |
-c | Snapshot: compact output |
-d <n> | Snapshot: limit tree depth |
Debugging
agent-browser --headed open http://localhost:3000
agent-browser console
agent-browser errors
agent-browser highlight @e5
agent-browser eval "document.title"
Tips
- Always snapshot first - Get refs before interacting
- Use
-i flag - Interactive-only snapshots are much cleaner
- Wait when needed - Use
wait <ms> or wait <selector> after actions that trigger loading
- Sessions for auth - Use named sessions to persist login state
- Headed for debugging - Use
--headed when things aren't working as expected