agent-browser
⚠️ This skill is for external websites via Chrome/CDP. To automate the Clawfirm app UI (WKWebView), use
browser-agentinstead — see the clawfirm-test skill.agent-browser≠browser-agent: different binaries, different protocols, different targets.
A browser automation skill powered by the agent-browser CLI. It controls Chrome/Chromium via CDP and uses compact element refs for fast, token-efficient interactions.
Prerequisites
Install agent-browser if not already available:
npm install -g agent-browser && agent-browser install
Or via Homebrew: brew install agent-browser
Core Workflow
Every browser automation follows this pattern:
- Open a URL:
agent-browser open <url> - Snapshot interactive elements:
agent-browser snapshot -i - Interact using refs from the snapshot:
agent-browser click @e1,agent-browser fill @e2 "text" - Re-snapshot after any page change to get fresh refs
Commands persist via a background daemon — chain them with && in a single bash call or run them sequentially.
Quick Examples
Navigate and extract text
agent-browser open https://example.com
agent-browser snapshot -i
agent-browser get text @e1
Fill a form
agent-browser open https://example.com/login
agent-browser snapshot -i
# Identify the form fields from snapshot output, then:
agent-browser fill @e3 "user@example.com"
agent-browser fill @e4 "password123"
agent-browser click @e5
agent-browser wait --load networkidle
agent-browser snapshot -i
Take a screenshot
agent-browser open https://example.com
agent-browser wait --load networkidle
agent-browser screenshot ./capture.png
# Or full page:
agent-browser screenshot --full ./full-page.png
Scrape data
agent-browser open https://example.com
agent-browser snapshot -i
agent-browser get text body
Key Commands
| Command | Description |
|---|---|
open <url> |
Navigate to URL |
snapshot -i |
Get interactive elements with @refs |
click @ref |
Click an element |
fill @ref "text" |
Clear field and type text |
type @ref "text" |
Type without clearing |
select @ref "value" |
Select dropdown option |
check @ref / uncheck @ref |
Toggle checkbox |
press Enter |
Press a key |
scroll down 500 |
Scroll the page |
get text @ref |
Get element text |
get url |
Get current URL |
get title |
Get page title |
screenshot [path] |
Capture screenshot |
wait @ref |
Wait for element |
wait --load networkidle |
Wait for network idle |
wait --text "Success" |
Wait for text to appear |
close |
Close browser session |
Important Rules
- Always snapshot before interacting — refs don't exist until you snapshot
- Re-snapshot after navigation — refs are invalidated when the page changes
- Re-snapshot after dynamic changes — clicking a button that opens a dropdown requires a new snapshot to see the new elements
- Use
waitfor slow pages —wait --load networkidlebefore snapshot on heavy pages - Close sessions when done —
agent-browser closeto prevent leaked processes
References
For the full command reference, read references/commands.md.
For snapshot/ref details, read references/snapshot-refs.md.
For authentication patterns, read references/authentication.md.
For session management, read references/session-management.md.