| name | browser-automation |
| description | Drive a real browser via Playwright for tasks that need JavaScript execution, login forms, or interactive UI. Use when: scraping a SPA, filling out a form, taking a screenshot, downloading from a JS-protected page, or running an end-to-end check. NOT for: static HTML (use web_fetch), public APIs (use curl), or anything where a simple HTTP GET works. |
| metadata | {"all_agents":{"emoji":"🌐","requires":{"bins":["python3"]}},"install":"pip install playwright && playwright install chromium"} |
Browser Automation
Use Playwright (Python) via run_command. Playwright is not a
runtime dependency of all-agents; the user installs it once.
One-time setup
pip install playwright
playwright install chromium
If neither is installed, ask the user to run those commands and then
retry.
Headless one-shot
For most tasks, write a tiny inline script. The run_command tool gives
you a workspace cwd; place scripts in playwright_scripts/.
from playwright.sync_api import sync_playwright
import sys, json
url = sys.argv[1]
with sync_playwright() as p:
browser = p.chromium.launch(headless=True)
page = browser.new_page()
page.goto(url, wait_until="networkidle")
print(json.dumps({"title": page.title(), "text": page.inner_text("body")[:5000]}))
browser.close()
Run it:
python playwright_scripts/fetch_page.py "https://example.com"
Common patterns
Screenshot
page.screenshot(path="screenshot.png", full_page=True)
Fill a form
page.goto(url)
page.fill('input[name="email"]', "...")
page.fill('input[name="password"]', "...")
page.click('button[type="submit"]')
page.wait_for_url("**/dashboard")
Wait for content
page.wait_for_selector(".result-card", timeout=10000)
Persistent login (cookies)
Save and reuse storage_state JSON between runs:
ctx = browser.new_context(storage_state="state.json")
ctx.storage_state(path="state.json")
Decision rules
| Situation | Use |
|---|
| Static page, content is in HTML | web_fetch (much faster) |
| API endpoint exists | run_command curl ... |
| JS rendering required | this skill |
| Login wall / cookies | this skill with persistent context |
| Form submission | this skill |
After the run
Stop the browser, summarize what was extracted, and reference any saved
files (screenshots, downloaded artifacts) in the workspace.