Browser automation (Playwright / agent-browser)
When it applies
The in-scope target (scope.txt, tradecraft-scope-roe) needs a real browser, not raw HTTP:
multi-step or JS-heavy login flows, pages that render client-side, payloads that must go through
the UI (XSS into a live DOM, CSRF flows), evidence screenshots, or scraping behind a session. For
pure request replay use Burp/curl instead; honor bug-bounty rate limits in roe.md — automation
multiplies request volume.
Why it works
A scripted browser executes the app's JavaScript, holds cookies/session like a real user, and sees
the post-render DOM — so guards that defeat raw HTTP (JS challenges, dynamic forms) just work. The
agent-browser CLI exposes the accessibility tree as stable @eN element refs, which survive
layout changes better than CSS selectors; the Playwright Node API adds network interception,
storage extraction, and screenshots for everything the CLI can't do.
Method
- Install once:
npm install -g playwright agent-browser && npx playwright install. - Core CLI loop — open, snapshot, act, verify, close:
```bash
agent-browser open "https://target.com/login"
agent-browser snapshot -i # interactive elements only → @e1, @e2...
agent-browser fill @e2 "admin"
agent-browser type @e3 "password" # type, not fill, when JS listens for input events
agent-browser click @e4
agent-browser wait --load networkidle
agent-browser get url # did we land in the authenticated area?
agent-browser close # mandatory — leaked processes hang later runs
```
Always snapshot before acting — refs are per-page-state, never guess them.
- Drop to the Playwright Node API when you need cookies/localStorage extraction, request
interception or response tampering (e.g. flip role: user → admin to test client-side
authorization), or fullPage screenshots for evidence. Full command and API reference, plus
pentest patterns (auto-login, XSS injection, batch payload loops):