| name | browser |
| description | Browser automation via agent-browser CLI. Navigate, snapshot, screenshot, click, fill, type, wait, eval, pdf. Use for visual verification, smoke testing, form interaction, and page inspection. Trigger on phrases like "check the browser", "take a screenshot", "test the page", "what does it look like", "verify the UI", "browser test", "open the app". |
Browser Automation
Use agent-browser CLI for all browser interaction. Run commands via the Bash tool. This is NOT an MCP server.
Pre-flight
Before testing, determine the app URL and port from project docs (CLAUDE.md, README, docker-compose, etc.). Ensure the app is running.
Commands
agent-browser open <url>
agent-browser snapshot
agent-browser screenshot /tmp/ss.png
agent-browser pdf /tmp/page.pdf
agent-browser click "<selector>"
agent-browser fill "<selector>" "val"
agent-browser type "<selector>" "val"
agent-browser hover "<selector>"
agent-browser wait "<selector>"
agent-browser eval "<js expression>"
Selectors
- CSS:
.my-class, #my-id, [data-role='save']
- Text:
button:text('Submit')
- Ref from snapshot:
@42
- Combined:
form#login input[name='email']
Workflow
open to navigate
snapshot to understand page structure (preferred for logic and finding selectors)
- Interact: click, fill, type
screenshot to visually verify (preferred for visual checks)
- Read the screenshot image to confirm
Login Flows
When the app requires authentication:
- Read project docs for login URL and credentials
open the login page
snapshot to find form fields
fill email/username and password fields
click the login/submit button
wait for redirect to dashboard/home
screenshot to confirm logged-in state
Testing Patterns
Happy path
- Navigate to the feature
- Perform the main user flow
- Verify expected outcome (screenshot + snapshot)
Forms
- Fill all required fields
- Submit
- Verify success feedback (flash, redirect, new content)
- Test with empty/invalid input
- Verify error messages appear
Edge cases
- Empty states (no data, empty lists)
- Long text, special characters, unicode
- Missing resources (404 pages)
- Rapid clicks, double submits
Visual verification
- Screenshot the page
- Read the screenshot to check layout, styles, content
- Check for broken images, misaligned elements, overflow
Screenshot & Evidence
When validating, capture evidence with descriptive names:
agent-browser screenshot /tmp/login-success.png
agent-browser screenshot /tmp/form-validation-error.png
agent-browser screenshot /tmp/empty-state.png
Console & Network
agent-browser eval "window.__errors || 'no error tracking'"
agent-browser eval "document.title"
agent-browser eval "window.location.href"
agent-browser eval "document.querySelector('.flash')?.textContent"
Tips
- Use
snapshot first to discover clickable elements and their refs
- Use
wait before interacting with dynamically loaded content (SPAs, LiveView, React)
- Screenshots go to
/tmp/ with descriptive names
fill sets value directly. type simulates keystrokes (use for inputs with JS handlers)
eval returns the JS expression result. Use for reading page state, localStorage, cookies
- After form submissions or navigation,
wait for the expected element before asserting
- When a page has multiple similar elements, use snapshot refs (
@N) for precision