Agent skill
browser-automation
Browser automation toolkit using Playwright. Supports interacting with web applications, form filling, capturing screenshots, viewing browser logs, and running automated tests. Use when automating browser tasks, testing web UI, or scraping web pages.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/browser-automation-hippocampus-dev-hippocampus
Metadata
Additional technical details for this skill
- short description
- playwright, browser, ブラウザ, 自動化, スクレイピング, e2e, screenshot, スクリーンショット, scraping
SKILL.md
- Write
@playwright/testscripts in TypeScript, run withnpx playwright test - Use
scripts/with-server.mjs --helpto manage server lifecycle - Wait for
networkidlebefore inspecting DOM on dynamic apps
Quick Start
npx playwright install chromium- Install browser (one-time)npx playwright test your-test.spec.ts- Run a test
Approach
- Static HTML → Read file directly to identify selectors, then write test
- Dynamic app (server not running) → Use
with-server.mjsto start server, then test - Dynamic app (server running) → Navigate, wait for
networkidle, inspect, then act
Basic Test Structure
import {test, expect, type Page} from "@playwright/test";
test("verify homepage loads", async ({page}: {page: Page}) => {
await page.goto("http://localhost:5173");
await page.waitForLoadState("networkidle");
await expect(page.locator("h1")).toBeVisible();
});
Using with-server.mjs
# Single server
node scripts/with-server.mjs --server "npm run dev" --port 5173 -- npx playwright test
# Multiple servers
node scripts/with-server.mjs \
--server "cd backend && python server.py" --port 3000 \
--server "cd frontend && npm run dev" --port 5173 \
-- npx playwright test
Best Practices
- Use
expect()for assertions instead of manual checks - Browser cleanup is automatic with
@playwright/test - Use descriptive selectors:
text=,role=, CSS selectors, or IDs - Add waits:
page.waitForSelector()orexpect().toBeVisible()
Reference Files
examples/element-discovery.spec.ts- Discovering buttons, links, inputsexamples/static-html-automation.spec.ts- Using file:// URLsexamples/console-logging.spec.ts- Capturing console logs
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?