| name | pwbrouser-debug |
| description | Debug web applications using the pwbrouser headful browser CLI. Navigate pages, inspect console errors, examine network requests, interact with UI elements, and capture ARIA snapshots or screenshots — all from the terminal. Use when debugging browser-based issues, investigating frontend errors, testing webapp behavior, or when user mentions web debugging, console errors, network failures, or browser inspection. |
pwbrouser Debug
Quick start
pwbrouser server start
pwbrouser navigate https://your-app.example.com
pwbrouser snapshot && pwbrouser console error && pwbrouser network
pwbrouser server stop
Always verify the server is running first: pwbrouser server status (shows PID, port, current page URL).
Debugging workflows
JS console errors
pwbrouser navigate https://your-app.example.com
pwbrouser console error
pwbrouser console warning
pwbrouser console info
Messages accumulate since last navigation. Reproduce the bug, then check the console.
Network / API failures
pwbrouser network
pwbrouser network /api/
pwbrouser network_req 3
pwbrouser network_req 5 response
Look for 4xx/5xx status codes, unexpected response bodies. Drill into specific requests with network_req <index>.
UI / layout issues
pwbrouser snapshot
pwbrouser screenshot ./debug.png
pwbrouser resize 375 812
Form submission bugs
pwbrouser fill textbox "Email" "test@example.com"
pwbrouser fill textbox "Password" "secret123"
pwbrouser select combobox "Country" "Spain"
pwbrouser click button "Submit"
pwbrouser console error
pwbrouser network /submit
For complex forms, use snapshot refs with --json (see REFERENCE.md).
For <select> dropdowns: pwbrouser select <role> <name> <value>...
Page load / navigation issues
pwbrouser navigate https://your-app.example.com
pwbrouser wait_for text "Dashboard"
pwbrouser wait_for textGone "Loading..."
pwbrouser back
pwbrouser snapshot && pwbrouser console error
Keyboard / accessibility issues
pwbrouser press_key Tab
pwbrouser press_key Enter
pwbrouser press_key Control+A
pwbrouser press_key ArrowDown
Use with snapshot before and after to verify focus changes.
Auth & session debugging
pwbrouser cookies
pwbrouser cookie set token "abc123"
pwbrouser cookie get token
pwbrouser cookie delete token
pwbrouser cookie clear
pwbrouser localstorage
pwbrouser localstorage get authToken
pwbrouser localstorage set theme "dark"
pwbrouser localstorage delete unusedKey
pwbrouser localstorage clear
pwbrouser sessionstorage
pwbrouser sessionstorage get sessionId
pwbrouser storage_state ./debug-session.json
pwbrouser set_state ./debug-session.json
Offline / network state debugging
pwbrouser network_state offline
pwbrouser navigate https://your-app.example.com
pwbrouser console error
pwbrouser network_state online
Multi-tab debugging
pwbrouser tabs list
pwbrouser tabs new https://example.com
pwbrouser tabs select 1
pwbrouser tabs close 0
Tabs share the same context (cookies, storage). Use this to debug cross-tab state synchronization.
API mocking
pwbrouser route "**/api/users" 200 '[]'
pwbrouser route "**/api/status" 500
pwbrouser route_list
pwbrouser unroute "**/api/users"
pwbrouser unroute
Drag-and-drop / file upload debugging
pwbrouser --json '{"method":"browser_drag","params":{"startTarget":{"ref":"e3"},"endTarget":{"ref":"e7"}}}'
pwbrouser --json '{"method":"browser_file_upload","params":{"paths":["/path/to/file.pdf"]}}'
Element targeting
Three ways to reference elements:
pwbrouser click button "Login"
pwbrouser --json '{"method":"browser_click","params":{"target":{"ref":"e15"}}}'
pwbrouser --json '{"method":"browser_click","params":{"target":{"selector":"button.primary"}}}'
Dialog handling: pwbrouser dialog accept [promptText] or pwbrouser dialog dismiss.
Iterative debugging loop
- Navigate →
pwbrouser navigate <url>
- Inspect →
pwbrouser snapshot + pwbrouser console error + pwbrouser network
- Interact →
pwbrouser click / pwbrouser fill / pwbrouser type
- Verify →
pwbrouser snapshot + pwbrouser network
- Repeat from step 3
Reference