skills/community/playwright-mcp/SKILL.md
Playwright MCP server: browser automation via MCP protocol, page interaction, form filling
npx skillsauth add alphaonedev/openclaw-graph playwright-mcpInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill provides a Playwright-based MCP server for browser automation, enabling programmatic control of web pages via the MCP protocol. It focuses on tasks like navigating sites, interacting with elements, and filling forms, integrated with OpenClaw for AI-driven workflows.
Use this skill for automating browser interactions in scenarios like web scraping, UI testing, or dynamic form submissions. It's ideal when you need remote browser control, such as in CI/CD pipelines, data extraction from JavaScript-heavy sites, or simulating user actions across multiple pages.
page.click('button').page.fill('input[name="username"]', 'user123').page.waitForSelector('selector').To use this skill, start the MCP server and send commands from OpenClaw. Always initialize with authentication via $PLAYWRIGHT_MCP_API_KEY. Pattern 1: Launch a browser session and perform actions in sequence. Pattern 2: Use in loops for repetitive tasks, like form testing. For integration, wrap calls in try-catch blocks. Example pattern: Set up server with CLI, then use API endpoints to execute scripts.
playwright-mcp start --port 8080 --headless to launch the server; add --debug for verbose logging./mcp/execute with JSON payload, e.g., {"action": "navigate", "url": "https://example.com"}.const response = fetch('http://localhost:8080/mcp/execute', {
method: 'POST',
headers: {'Authorization': `Bearer ${process.env.PLAYWRIGHT_MCP_API_KEY}`},
body: JSON.stringify({action: 'goto', url: 'https://example.com'})
});
/mcp/interact endpoint, e.g., POST with {"selector": '#id', "action": "click"}.--config path/to/config.json.$PLAYWRIGHT_MCP_API_KEY in headers; check for 401 errors if missing.Integrate by running the server as a subprocess or via HTTP clients in OpenClaw. Set $PLAYWRIGHT_MCP_API_KEY as an environment variable for authentication. For example, in OpenClaw scripts, import as a module and call functions like mcpClient.execute({action: 'fill', selector: 'input', value: 'data'}). Use WebSockets for real-time updates on /mcp/ws. Ensure compatibility with Node.js 14+; handle CORS by adding --allow-origins *` to CLI. Test integrations with mock servers to simulate failures.
Common errors include timeout exceptions (e.g., network delays) or selector failures; use page.waitForTimeout(5000) before actions. For API errors, check response codes: 404 for invalid endpoints, 500 for server issues. Handle with try-catch in code, e.g.:
try {
await page.click('nonexistent');
} catch (error) {
console.error('Element not found:', error.message);
// Retry or fallback
}
Prescribe logging all errors with --debug flag. For authentication failures, verify $PLAYWRIGHT_MCP_API_KEY and retry. Use exponential backoff for transient errors like 429 (rate limit).
playwright-mcp start --port 8080, then send API call to fill and submit a login form: POST /mcp/execute with {"action": "fill", "selector": '#username', "value": "testuser", "then": "click('#submit')"}. This extracts data or verifies login success.playwright-mcp execute --url 'https://site.com' --script 'page.evaluate(() => document.querySelector("#data").textContent)', then process the output for analysis.tools
Root web development: project structure, tooling selection, deployment decisions
development
WebAssembly: Rust/Go/C to WASM, wasm-bindgen, Emscripten, WASM Component Model
development
Vue 3: Composition API script setup, Pinia, Vue Router 4, SFCs, Vite, Nuxt 3
tools
Tailwind CSS 4: utility classes, config, JIT, arbitrary values, darkMode, plugins, shadcn/ui