Control a headless browser using Playwright to navigate URLs, authenticate to websites, click through multi-step flows, fill/submit forms, take screenshots, and scrape dynamic content when curl/API access is insufficient.
Use this skill when an agent must interact with real websites like a human.
config/selectors/common.json)storageStatepauseForMfa)scripts/launch_browser.js — browser sanity launch + screenshotscripts/login_flow.js — reusable login/session capture helperscripts/run_task.js — generic step runner (goto/click/fill/wait/screenshot/scrapeText)cd skills/browser-automation
npm install playwright
npx playwright install chromium
node scripts/launch_browser.js ./artifacts
Edit config/login.example.json and run:
node scripts/login_flow.js config/login.example.json
Edit config/task.example.json and run:
node scripts/run_task.js config/task.example.json
headless mode togglestorageStatePathReturn structured JSON including:
okdata (scraped values)screenshots (local file paths)finalUrlerror with failing step details (if failed)waitForURL with expected pattern.storageState from login flow.