| name | agent-browser |
| description | Browser automation CLI — navigate pages, take screenshots, click elements, fill forms, extract CSS, and check console errors. |
| invoke_when | Task requires browser interaction — navigating to a URL, taking screenshots, clicking elements, filling forms, checking console errors, or testing a web page. This is the primary skill for any task that involves operating a browser. |
agent-browser
Browser automation CLI. Commands follow this pattern:
agent-browser [flags] <command> [args]
agent-browser --help
agent-browser <command> --help
Core Workflow
agent-browser open <url> && agent-browser wait --load networkidle
agent-browser snapshot -i
agent-browser fill @e2 "text" && agent-browser click @e1
agent-browser snapshot -i
IMPORTANT: Refs (@e1, @e2, ...) are invalidated when the page changes. Always re-snapshot after clicking links, submitting forms, or any action that changes the page.
Command Chaining — PREFERRED
Always chain independent commands with && in a single bash call. The browser persists between commands via a background daemon, so chaining is safe. This minimizes the number of bash tool calls.
agent-browser open <url> && \
agent-browser wait --load networkidle && \
agent-browser set viewport 1440 900 && \
agent-browser screenshot /path/to/output.png
agent-browser fill @e1 "user@example.com" && \
agent-browser fill @e2 "password123" && \
agent-browser click @e3 && \
agent-browser wait --load networkidle
When to run separately (only when you need to read the output before proceeding):
snapshot -i → parse the refs → then interact using those refs
get url / get text → read the value → then branch on it
Everything else: chain it.
Navigation
agent-browser open <url>
agent-browser back
agent-browser forward
agent-browser reload
agent-browser close
Snapshot (Getting Element Refs)
agent-browser snapshot -i
agent-browser snapshot -i -C
agent-browser snapshot -s "#selector"
agent-browser snapshot -i -c
Snapshot output format:
@e1 [button] "Submit"
@e2 [input type="email"] placeholder="Email"
@e3 [a href="/about"] "About"
Interaction (use @refs from snapshot)
agent-browser click @e1
agent-browser click @e1 --new-tab
agent-browser fill @e2 "text"
agent-browser type @e2 "text"
agent-browser select @e3 "value"
agent-browser check @e4
agent-browser hover @e5
agent-browser press Enter
agent-browser scroll down 500
agent-browser scrollintoview @e1
Viewport
agent-browser set viewport 1440 900
agent-browser set viewport 2560 1440
agent-browser set media dark
agent-browser set media light
Screenshots
agent-browser screenshot <path>
agent-browser screenshot --full <path>
agent-browser screenshot --annotate
For element-scoped screenshots (no direct uid support):
agent-browser scrollintoview @eN
agent-browser screenshot <path>
Wait
agent-browser wait --load networkidle
agent-browser wait --text "Welcome"
agent-browser wait --url "**/dashboard"
agent-browser wait @e1
agent-browser wait 2000
Get Information
agent-browser get text @e1
agent-browser get url
agent-browser get title
agent-browser get styles @e1
agent-browser get attr @e1 href
Tabs (Multi-Page)
agent-browser tab new <url>
agent-browser tab
agent-browser tab 1
agent-browser tab close
agent-browser tab close 2
Console and Errors
agent-browser errors
agent-browser errors --clear
agent-browser console
agent-browser console --clear
JavaScript Evaluation
For simple expressions:
agent-browser eval 'document.title'
For complex/multiline scripts, use --stdin with heredoc to avoid shell quoting issues:
agent-browser eval --stdin <<'EVALEOF'
JSON.stringify(
['body','h1','h2','p','a','button'].reduce((acc, sel) => {
const el = document.querySelector(sel);
if (!el) return acc;
const s = getComputedStyle(el);
acc[sel] = { color: s.color, backgroundColor: s.backgroundColor, fontFamily: s.fontFamily };
return acc;
}, {})
)
EVALEOF
Use --stdin for any script with nested quotes, arrow functions, or template literals.
Annotated Screenshots (Vision Mode)
agent-browser screenshot --annotate
agent-browser click @e1
Use annotated screenshots when:
- Page has unlabeled icon buttons or visual-only elements
- You need to see spatial layout and element positions
- Canvas or chart elements are present (invisible to text snapshots)
Deep-Dive References