···35353636### Snapshot (page analysis)
3737```bash
3838-agent-browser snapshot # Full accessibility tree
3939-agent-browser snapshot -i # Interactive elements only (recommended)
4040-agent-browser snapshot -c # Compact output
4141-agent-browser snapshot -d 3 # Limit depth to 3
3838+agent-browser snapshot # Full accessibility tree
3939+agent-browser snapshot -i # Interactive elements only (recommended)
4040+agent-browser snapshot -c # Compact output
4141+agent-browser snapshot -d 3 # Limit depth to 3
4242+agent-browser snapshot -s "#main" # Scope to CSS selector
4243```
43444445### Interactions (use @refs from snapshot)
4546```bash
4647agent-browser click @e1 # Click
4748agent-browser dblclick @e1 # Double-click
4949+agent-browser focus @e1 # Focus element
4850agent-browser fill @e2 "text" # Clear and type
4951agent-browser type @e2 "text" # Type without clearing
5052agent-browser press Enter # Press key
5153agent-browser press Control+a # Key combination
5454+agent-browser keydown Shift # Hold key down
5555+agent-browser keyup Shift # Release key
5256agent-browser hover @e1 # Hover
5357agent-browser check @e1 # Check checkbox
5458agent-browser uncheck @e1 # Uncheck checkbox
5559agent-browser select @e1 "value" # Select dropdown
5660agent-browser scroll down 500 # Scroll page
5761agent-browser scrollintoview @e1 # Scroll element into view
6262+agent-browser drag @e1 @e2 # Drag and drop
6363+agent-browser upload @e1 file.pdf # Upload files
5864```
59656066### Get information
6167```bash
6268agent-browser get text @e1 # Get element text
6969+agent-browser get html @e1 # Get innerHTML
6370agent-browser get value @e1 # Get input value
7171+agent-browser get attr @e1 href # Get attribute
6472agent-browser get title # Get page title
6573agent-browser get url # Get current URL
7474+agent-browser get count ".item" # Count matching elements
7575+agent-browser get box @e1 # Get bounding box
6676```
67776868-### Screenshots
7878+### Check state
7979+```bash
8080+agent-browser is visible @e1 # Check if visible
8181+agent-browser is enabled @e1 # Check if enabled
8282+agent-browser is checked @e1 # Check if checked
8383+```
8484+8585+### Screenshots & PDF
6986```bash
7087agent-browser screenshot # Screenshot to stdout
7188agent-browser screenshot path.png # Save to file
7289agent-browser screenshot --full # Full page
9090+agent-browser pdf output.pdf # Save as PDF
7391```
74929393+### Video recording
9494+```bash
9595+agent-browser record start ./demo.webm # Start recording (uses current URL + state)
9696+agent-browser click @e1 # Perform actions
9797+agent-browser record stop # Stop and save video
9898+agent-browser record restart ./take2.webm # Stop current + start new recording
9999+```
100100+Recording creates a fresh context but preserves cookies/storage from your session. If no URL is provided, it automatically returns to your current page. For smooth demos, explore first, then start recording.
101101+75102### Wait
76103```bash
77104agent-browser wait @e1 # Wait for element
78105agent-browser wait 2000 # Wait milliseconds
79106agent-browser wait --text "Success" # Wait for text
107107+agent-browser wait --url "**/dashboard" # Wait for URL pattern
80108agent-browser wait --load networkidle # Wait for network idle
109109+agent-browser wait --fn "window.ready" # Wait for JS condition
110110+```
111111+112112+### Mouse control
113113+```bash
114114+agent-browser mouse move 100 200 # Move mouse
115115+agent-browser mouse down left # Press button
116116+agent-browser mouse up left # Release button
117117+agent-browser mouse wheel 100 # Scroll wheel
81118```
8211983120### Semantic locators (alternative to refs)
···85122agent-browser find role button click --name "Submit"
86123agent-browser find text "Sign In" click
87124agent-browser find label "Email" fill "user@test.com"
125125+agent-browser find first ".item" click
126126+agent-browser find nth 2 "a" text
127127+```
128128+129129+### Browser settings
130130+```bash
131131+agent-browser set viewport 1920 1080 # Set viewport size
132132+agent-browser set device "iPhone 14" # Emulate device
133133+agent-browser set geo 37.7749 -122.4194 # Set geolocation
134134+agent-browser set offline on # Toggle offline mode
135135+agent-browser set headers '{"X-Key":"v"}' # Extra HTTP headers
136136+agent-browser set credentials user pass # HTTP basic auth
137137+agent-browser set media dark # Emulate color scheme
138138+```
139139+140140+### Cookies & Storage
141141+```bash
142142+agent-browser cookies # Get all cookies
143143+agent-browser cookies set name value # Set cookie
144144+agent-browser cookies clear # Clear cookies
145145+agent-browser storage local # Get all localStorage
146146+agent-browser storage local key # Get specific key
147147+agent-browser storage local set k v # Set value
148148+agent-browser storage local clear # Clear all
149149+```
150150+151151+### Network
152152+```bash
153153+agent-browser network route <url> # Intercept requests
154154+agent-browser network route <url> --abort # Block requests
155155+agent-browser network route <url> --body '{}' # Mock response
156156+agent-browser network unroute [url] # Remove routes
157157+agent-browser network requests # View tracked requests
158158+agent-browser network requests --filter api # Filter requests
159159+```
160160+161161+### Tabs & Windows
162162+```bash
163163+agent-browser tab # List tabs
164164+agent-browser tab new [url] # New tab
165165+agent-browser tab 2 # Switch to tab
166166+agent-browser tab close # Close tab
167167+agent-browser window new # New window
168168+```
169169+170170+### Frames
171171+```bash
172172+agent-browser frame "#iframe" # Switch to iframe
173173+agent-browser frame main # Back to main frame
174174+```
175175+176176+### Dialogs
177177+```bash
178178+agent-browser dialog accept [text] # Accept dialog
179179+agent-browser dialog dismiss # Dismiss dialog
180180+```
181181+182182+### JavaScript
183183+```bash
184184+agent-browser eval "document.title" # Run JavaScript
88185```
8918690187## Example: Form submission
···137234## Debugging
138235139236```bash
237237+agent-browser open example.com --headed # Show browser window
238238+agent-browser console # View console messages
239239+agent-browser errors # View page errors
240240+agent-browser record start ./debug.webm # Record from current page
241241+agent-browser record stop # Save recording
140242agent-browser open example.com --headed # Show browser window
243243+agent-browser --cdp 9222 snapshot # Connect via CDP
141244agent-browser console # View console messages
245245+agent-browser console --clear # Clear console
142246agent-browser errors # View page errors
247247+agent-browser errors --clear # Clear errors
248248+agent-browser highlight @e1 # Highlight element
249249+agent-browser trace start # Start recording trace
250250+agent-browser trace stop trace.zip # Stop and save trace
143251```
···50505151Once you have answers, restate the requirements in 1-3 sentences (including key constraints and what success looks like), then start work.
52525353-## Question templates
5353+## Question Templates
54545555- "Before I start, I need: (1) ..., (2) ..., (3) .... If you don't care about (2), I will assume ...."
5656- "Which of these should it be? A) ... B) ... C) ... (pick one)"
···7171Reply with: defaults (or 1a 2a)
7272```
73737474-## Anti-patterns
7474+## Anti-Patterns
75757676- Don't ask questions you can answer with a quick, low-risk discovery read (e.g., configs, existing patterns, docs).
7777- Don't ask open-ended questions if a tight multiple-choice or yes/no would eliminate ambiguity faster.