Skip to content
skillcellar
All skills

Playwright CLI

Testing

Microsoft's Playwright command line plus an agent skill: Claude Code drives a browser with short commands.

Stars15.6k
Forks979
Watchers55
Open issues0
LicenseApache-2.0
Last push3 days ago

Install

install

$ npm install -g @playwright/cli@latest && playwright-cli install --skills

Update

update

$ npm install -g @playwright/cli@latest

Run playwright-cli install --skills again to refresh the installed skill.

When to use it

  • You want Claude Code to open your app, click through it and screenshot passing and failing flows.
  • You want browser automation that spends fewer tokens than a full MCP tool schema.
  • You need to run, debug or generate Playwright tests, mock requests or record traces.
  • You want to attach screenshots or videos to a pull request as evidence.

Commands & flags

playwright-cli open https://playwright.dev --headed
Open a page; the browser is headless unless you pass --headed.
playwright-cli click e15
Click an element by the ref shown in the page snapshot.
playwright-cli type "Buy groceries"
Type text into the focused element.
playwright-cli screenshot
Save a screenshot of the current page.
playwright-cli -s=name open <url>
Use a named session so several projects keep separate browsers.
playwright-cli show
Open a dashboard with live previews of every running browser session.

How to use it

Install the CLI globally, then install its skill so Claude Code can find it:

npm install -g @playwright/cli@latest
playwright-cli install --skills

Then ask in plain language, for example: Use playwright skills to test https://demo.playwright.dev/todomvc/. Take screenshots for all successful and failing scenarios. Without the skill, point the agent at playwright-cli --help and it can learn the commands from there.

Run Claude Code with PLAYWRIGHT_CLI_SESSION=<name> to give each project its own browser session.

Why it earns its place

Microsoft's README notes that coding agents increasingly favor this CLI-plus-skill route: short commands avoid loading large tool schemas and verbose accessibility trees into the model's context. The bundled skill also covers test generation, request mocking, tracing and video recording, so one install handles the "open my app and catch visual bugs" job and the follow-up of turning it into a test.

If you want a persistent, introspective browser loop instead of one-off commands, the Playwright MCP server (see its entry) fits better. Needs Node.js and a Playwright version that supports the CLI.

Try it

claude

> Use playwright-cli to open http://localhost:3000, walk through the signup flow and screenshot every step that fails.