playwright-mcp
Skill8 starsChanged 2 months agoMITView on GitHub
Drive the live application through Playwright's MCP servers for exploration, locator discovery, test generation, and failure diagnosis. Use when planning coverage, confirming an accessible name, generating a case, or investigating a failure.
5 other projects use a version of this.
Adopted by
Most recently taken up by
- bmcszk/agent-skillstheir own version, first seen Sep 23, 2026
- beelabstudio/aitheir own version, first seen Sep 20, 2026
- weininghui/skillstheir own version, first seen Aug 23, 2026
- Hainrixz/editor-pro-maxtheir own version, first seen Mar 26, 2026
- BhavinM/my-claude-setuptheir own version, first seen Feb 16, 2026
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- Hainrixz/editor-pro-max★ 259same name
- bmcszk/agent-skills★ 1same name
- weininghui/skills★ 1same name
- beelabstudio/ai★ 0same name
- BhavinM/my-claude-setup★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository4 other files it gives its agents.
- docs/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- playwright-pageobject-testingSkill
- playwright-visual-regressionSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 54
Use the browser_verify_* tools for checks, so verifications survive into the generated test as assertions instead of being lost as …
- Very specific: line 63
No accessible name and no data-qa is a finding worth recording: the page object will need a documented CSS fallback.
- Distinctive: line 77
Search matches category names as well as product names.
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Playwright MCP Skill
Outcome
Agents inspect the real application instead of guessing. Every locator that reaches a page object was confirmed against a live accessibility snapshot first.
Two Servers, Two Jobs
.mcp.json registers both. Pick by task, not by habit.
| Server | Command | Use for |
playwright-test | npx playwright run-test-mcp-server | Planning, generating, and healing tests |
playwright | npx playwright-mcp | Ad-hoc exploration outside test authoring |
Prefer playwright-test. It reads playwright.config.ts, so it already knows this project's
baseURL, the data-qa test id attribute and the 1920x1080 viewport, so an agent resolves locators
exactly as the suite will. It also exposes tools the general server has no equivalent for:
| Tool | Purpose |
planner_setup_page | Initialise the page before any exploration. Call once, first |
planner_save_plan | Persist the finished plan |
generator_setup_page | Set up the page for the scenario being generated |
generator_read_log | Retrieve the recorded actions after walking a scenario |
generator_write_test | Write the generated spec |
browser_verify_text_visible, browser_verify_element_visible, browser_verify_value | Record verifications as assertions rather than bare clicks |
The agent definitions in .claude/agents/ are generated by
npx playwright init-agents --loop=claude and carry the exact tool list for the installed Playwright
version. Regenerate them after upgrading Playwright, then re-append the "Project rules for this
repository" section each one ends with.
When Not To Use MCP
- Not for running the suite. Tests run through
yarn test:e2eandyarn test:vr. MCP explores and generates; it does not execute the suite. - Not as a recorder. A transcribed click sequence is not a test: it has no page objects, no intent, and assertions only where someone remembered them. Use what the session established, then write the spec properly.
Method
planner_setup_page(orgenerator_setup_page) once, before anything else.browser_snapshot: the accessibility tree is the source of truth for locators. Theroleand the accessiblenameare whatgetByRolewill match.- Interact to reach each state the plan needs; snapshot again at every state worth asserting on.
- Use the
browser_verify_*tools for checks, so verifications survive into the generated test as assertions instead of being lost as navigation. - Record the confirmed accessible names in the plan.
Locator Discovery Rules
- A real role and name in the snapshot means the locator is
getByRole(role, { name }). - An element carrying
data-qais reachable throughgetByTestId, becausetestIdAttributemaps onto it in the project config and the authoring server picks that up. - No accessible name and no
data-qais a finding worth recording: the page object will need a documented CSS fallback. - Two elements sharing one accessible name is a scoping problem to solve in the page object, not a
reason to reach for
nth().
Known Traps In This Application
- The consent banner renders inside a shadow DOM. Playwright locators pierce open shadow roots,
so
getByRole("button", { name: "Consent" })resolves it, whiledocument.querySelectorfrom an evaluate call will not. Do not conclude the button is missing. - Third-party ad iframes inject after load and shift layout. The test fixture aborts those hosts, so a suite run and an MCP session can render differently. Check which one you are looking at.
/delete_accountdeletes immediately on GET. Do not navigate there while exploring with an account you still need.- Search matches category names as well as product names.
Vendor documentation
references/playwright-mcp-best-practices.md maps the official guidance onto the repository: the two servers, the flags that make a session match the suite, and what MCP is not for.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

