Loading...
Loading...
Web automation, debugging, and E2E testing with Playwright. Handles interactive (login, forms, reproduce bugs) and passive modes (network/console capture). Triggers on "e2e test", "browser test", "playwright", "screenshot", "debug UI", "debug frontend", "reproduce bug", "network trace", "console output", "verify fix", "test that", "verify change", "test the flow", "http://localhost", "open browser", "click button", "fill form", "submit form", "check page", "web scraping", "automation script", "headless browser", "browser automation", "selenium alternative", "puppeteer alternative", "page object", "web testing", "UI testing", "frontend testing", "visual regression", "capture network", "intercept requests", "mock API responses". PROACTIVE: Invoke for security verification, UI fix verification, testing forms/dropdowns, or multi-step UI flows. ON SESSION RESUME - check for pending UI verifications.
npx skill4agent add mauromedda/agent-toolkit web-automationreferences/python-patterns.mdreferences/javascript-patterns.md| Task | Helper Script |
|---|---|
| Login / fill forms | |
| Take screenshots | |
| Handle cookie consent | |
| Discover page elements | |
| Capture network traffic | |
| Debug console errors | |
| Full debug (network+console) | |
| Compare websites visually | |
uv run ~/.claude/skills/web-automation/examples/python/element_discovery.py http://localhost:3000
uv run ~/.claude/skills/web-automation/examples/python/screenshot_capture.py http://localhost:3000 --output /tmp/shots| Mode | When to Use | Example |
|---|---|---|
| Interactive | Click, type, navigate | Login flow, form submission |
| Passive | Observe only | Network capture, console monitoring |
| E2E Testing | Automated test suites | Playwright Test framework |
┌─────────────────────────────────────────────────────────────┐
│ SESSION RESUMED - WEB AUTOMATION VERIFICATION │
│ │
│ 1. Was I in the middle of browser automation? │
│ → Run: ps aux | grep -E "chromium|playwright|node" │
│ │
│ 2. Were there UI verification tasks pending? │
│ → Check summary for "verify", "test UI", "screenshot" │
│ │
│ 3. Did previous automation capture any findings? │
│ → Check /tmp/ for screenshots, debug outputs │
└─────────────────────────────────────────────────────────────┘Task:
+-- Need to interact? (click, type, submit) → Interactive mode
+-- Just observe/capture? → Passive mode (combined_debugger.py)
+-- Security verification? → Passive mode + grep for sensitive patternspage.goto()page.goto('https://example.com')
page.wait_for_load_state('networkidle')
# Dismiss cookie consent
for sel in ['button:has-text("Accept all")', '[class*="cookie"] button[class*="accept"]']:
try:
btn = page.locator(sel).first
if btn.is_visible(timeout=2000):
btn.click()
break
except:
continuepage.evaluate('''() => {
const patterns = ['cookie', 'consent', 'modal', 'overlay', 'popup', 'backdrop'];
for (const p of patterns) {
document.querySelectorAll(`[class*="${p}"], [id*="${p}"]`).forEach(el => {
if (getComputedStyle(el).position === 'fixed') el.remove();
});
}
document.body.style.overflow = 'auto';
}''')references/python-patterns.mdfrom playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch(headless=True)
page = browser.new_page()
page.goto('http://localhost:3000')
page.wait_for_load_state('networkidle') # CRITICAL
# ... automation
browser.close()import { test, expect } from '@playwright/test';
test('example', async ({ page }) => {
await page.goto('/');
await page.waitForLoadState('networkidle');
await expect(page.locator('.element')).toBeVisible();
});| Operation | Python | JavaScript |
|---|---|---|
| Screenshot | | |
| Full page | | |
| Fill input | | |
| Select dropdown | | |
| Click | | |
| Wait network | | |
| Wait element | | |
page.get_by_role('button', name='Submit')page.get_by_text('Click me')page.get_by_test_id('submit-btn')page.locator('.btn-primary')page.locator('//button[@type="submit"]')| What to Verify | Approach |
|---|---|
| Dropdown value | |
| Input text | |
| Element visible | |
| Text content | |
| Page URL | |
| Script | Purpose | Example |
|---|---|---|
| Network + Console + Errors | |
| Network only | |
| Console/errors only | |
# After Gemini found sensitive data logging
uv run ~/.claude/skills/web-automation/scripts/console_debugger.py \
http://localhost:3000 --duration 60 --output /tmp/security.json
grep -i "password\|token\|secret\|bearer" /tmp/security.json# Compare two sites
uv run ~/.claude/skills/web-automation/examples/python/visual_compare.py \
https://reference-site.com \
http://localhost:3000 \
--output /tmp/compare
# Then read the screenshots using Read tool| Use Case | Recommended | Reason |
|---|---|---|
| Existing JS/TS project | JavaScript | Consistent tooling |
| Existing Python project | Python | Consistent tooling |
| Quick scripts | Python | Simpler setup with |
| Test suites | JavaScript | Better |
references/test-framework.mdtest_utils.py# Detect and run tests with server
uv run ~/.claude/skills/web-automation/scripts/test_utils.py . --run --with-server| Pitfall | Solution |
|---|---|
| Overlay blocking clicks | Call overlay dismissal after EVERY page load |
| DOM inspection before JS loads | Always |
| Headful browser in CI | Always use |
| Flaky selectors | Prefer role/text selectors over CSS classes |
| Race conditions | Use explicit waits, not |
uv runnpm init -y
npm install -D @playwright/test
npx playwright install chromiumnpx playwright test # Run all
npx playwright test --ui # UI mode
npx playwright test --headed # See browserpip install pytest-playwright
pytest tests/