Agent skill
playwright
Playwright browser automation via Playwright MCP
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/playwright-baphled-dotopencode
SKILL.md
Skill: playwright
What I do
I provide expertise in Playwright browser automation via the Playwright MCP server. This includes navigation, form interaction, state snapshots, and debugging for reliable browser-based automation and testing.
When to use me
- Automating browser-based workflows (navigation, filling forms, clicking)
- Taking page snapshots and screenshots for visual verification
- Interacting with complex web applications (dialogs, file uploads, drag-and-drop)
- Debugging browser state via console logs and network requests
- Managing browser tabs and resizing viewports
Core principles
- Snapshot-first workflow - Always take a snapshot (
browser_snapshot) before interacting to get stable element references. - Actionable references - Prefer using element IDs or stable selectors from snapshots over brittle CSS paths.
- Wait for state - Use
browser_wait_forinstead of arbitrary delays to ensure the UI is ready for interaction. - Deterministic interaction - Perform one action at a time and verify the result via a new snapshot or assertion.
- Clean cleanup - Always close the browser session (
browser_close) when the task is complete.
Patterns & examples
Stable interaction flow:
// 1. Navigate to target
await skill_mcp(mcp_name="playwright", tool_name="browser_navigate", arguments={ url: "https://example.com/login" });
// 2. Take snapshot to find element IDs
const snapshot = await skill_mcp(mcp_name="playwright", tool_name="browser_snapshot");
// 3. Fill form using IDs from snapshot
await skill_mcp(mcp_name="playwright", tool_name="browser_fill_form", arguments={ selector: "#email", value: "[email protected]" });
await skill_mcp(mcp_name="playwright", tool_name="browser_fill_form", arguments={ selector: "#password", value: "secret123" });
await skill_mcp(mcp_name="playwright", tool_name="browser_click", arguments={ selector: "button[type='submit']" });
Waiting for results:
// Wait for specific element to appear after action
await skill_mcp(mcp_name="playwright", tool_name="browser_wait_for", arguments={ selector: ".dashboard-ready" });
// Verify state via console check or snapshot
const logs = await skill_mcp(mcp_name="playwright", tool_name="browser_console_messages");
Anti-patterns to avoid
- ❌ Arbitrary time-based sleeps (use
browser_wait_forinstead) - ❌ Interacting without a fresh snapshot (risks stale element references)
- ❌ Using brittle CSS/XPath selectors (prefer IDs or stable roles from snapshots)
- ❌ Leaving browser sessions open (always
browser_closeto save resources) - ❌ Ignoring console errors or failed network requests when debugging
KB Reference
~/vaults/baphled/3. Resources/Knowledge Base/AI Development System/Skills/Testing-BDD/Playwright.md
Related skills
javascript- Core language for complex evaluation scriptscypress- Alternative browser testing frameworke2e-testing- General end-to-end testing patternsbdd-workflow- Driving browser automation from behaviour specs
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?