name: playwright-mcp-automation description: Launch and operate the Playwright MCP server to let agents browse real websites (login, search, checkout, dashboards) through structured tools. Use when the task requires interacting with live pages beyond simple fetches—e.g., filling ecommerce carts, downloading statements behind auth, capturing screenshots, or testing UI flows with Playwright automation.
Use this skill whenever an agent must drive a real browser session via the Playwright MCP server. It covers standing up the MCP daemon, wiring it into your MCP client, and running reliable automation loops (login → navigate → act → verify). Pair these instructions with the upstream repo (https://github.com/microsoft/playwright-mcp) for the latest binaries.
Bundled resources
- references/setup.md — launch recipes, flags, troubleshooting.
- references/tools.md — quick lookup table for MCP tools.
- scripts/start_playwright_mcp.sh — opinionated launcher (persistent profile, sane timeouts). Override via env vars or CLI flags.
bash
npx playwright install chromium
# Linux only: installs missing libraries (x11, fonts, etc.)
sudo npx playwright install-deps chromiumscripts/start_playwright_mcp.sh from this skill directory. Override with PWMCP_BROWSER, PWMCP_PORT, etc.references/setup.md §2–5.json
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest", "--browser=chromium", "--user-data-dir=/home/ai/.cache/playwright/mcp-profile", "--allowed-hosts=*", "--snapshot-mode=incremental"]
}
}
}--port/--host then set "url": "http://HOST:PORT/mcp".browser_navigate to https://example.com, then browser_snapshot. If the tree renders, automation is ready.7w4.net收录了海量优质技能插件。
Follow this loop for every task. Refer to references/tools.md for exact tool signatures.
browser_navigate to the starting URL.browser_snapshot to capture the accessibility tree.--device, --viewport-size) or call browser_resize.Use semantic tools whenever possible:
- Inputs/buttons: browser_click, browser_type, browser_fill_form.
- Dropdowns: browser_select_option.
- Dynamic menus/tooltips: browser_hover → browser_wait_for.
- Multi-step flows (wizards, carts): after every step, browser_snapshot + assert expected text before proceeding.
- When markup lacks good roles, enable --caps=vision and fall back to browser_mouse_* tools, but only as a last resort.
- For brittle sequences (e.g., injecting JS, intercepting fetch), wrap logic inside browser_run_code:
js
async (page) => {
await page.waitForSelector('text=Place order');
await page.getByRole('button', { name: 'Place order' }).click();
return await page.getByTestId('order-number').innerText();
}
browser_wait_for with text / textGone over arbitrary sleeps.browser_console_messages, browser_network_requests) to debug API errors or CSP blocks.browser_snapshot and, if needed, browser_take_screenshot or browser_pdf_save (enable --caps=pdf).browser_tabs and ensure the correct tab is selected before final actions.browser_close at the end of unattended runs to release the browser.PWMCP_PROFILE. Great for daily automations.storage.json. Launch with --storage-state=/path/to/storage.json (see setup reference §4).--secrets path/.env so MCP can expose sensitive values via secrets.get. Include API keys or 2FA tokens there instead of SKILL files.--extension. Follow upstream README for pairing.--timeout-action/--timeout-navigation, or stage requests via browser_wait_for { time }.--save-video/--save-trace unless debugging.browser_snapshot filename) for audit trails, especially when producing evidence (e.g., order confirmations).references/setup.md.references/tools.md.scripts/start_playwright_mcp.sh. Export env vars (PWMCP_PORT, PWMCP_EXTRA="--headless") before running to tweak behavior.Keep SKILL.md lean by offloading details to the references. Update references/scripts whenever the upstream Playwright MCP release adds new capabilities (vision, pdf, devtools, etc.).
这个Skill质量不错,文档写得清楚有条理。它把Playwright浏览器自动化的使用方法说明得很全面,包括怎么启动、怎么操作、怎么处理问题等。好的地方是有完整的操作步骤、多种登录方式可选、还有脚本可以直接用。不足的是缺少实际使用例子,而且一些常见问题的解答也不够充分,对新手来说可能还需要自己摸索更多。总体来说,这是一个功能完整但文档可以更丰富的Skill。