Skip to Content
MeowKit
Skills

mk:playwright-cli

Scripted browser control through the Playwright CLI using accessibility snapshots and element refs.

Source.claude/skills/playwright-cli/SKILL.md
Ownertesting
Runtimeclaude-code
Riskmedium

What it does

Drives a browser from the shell with the Playwright CLI. It reads the page as an accessibility snapshot with element refs (e1, e2, ...) and acts on those refs. Use it for a known click-and-type sequence: DOM interaction, navigation, form filling, data extraction, screenshots, or generating reusable .spec.ts E2E test code.

When not to use

Use mk:agent-browser when you need session persistence across auth flows, MFA or cookie import.

Usage

playwright-cli open https://example.com/form
playwright-cli snapshot
playwright-cli fill e1 "user@example.com"
playwright-cli click e3
playwright-cli snapshot
playwright-cli close

If the global binary is missing, run npx --yes @playwright/cli@0.1.24 <command> (the bare playwright-cli package name is deprecated).

GroupCommands
Navigateopen <url>, goto <url>, go-back, go-forward, reload
Interactclick, fill e5 "text" (clears first), type "text", press Enter, select e9 "value", check, uncheck
Capturesnapshot [--filename=x.yaml], screenshot [--filename=x.png], pdf --filename=x.pdf
Sessions-s=NAME open <url> --persistent, list, close, close-all, kill-all
Auth statestate-save auth.json, state-load auth.json
Storagecookie-list, cookie-set, cookie-delete, cookie-clear, localstorage-get, localstorage-set
Networkroute "<pattern>" --status=404, route "<pattern>" --body='{...}', unroute, network
Debugconsole, tracing-start, tracing-stop, video-start, video-stop x.webm, run-code "async page => ..."

The full list is references/command-reference.md. Topic references are session-management.md, request-mocking.md, storage-state.md, test-generation.md, tracing.md, video-recording.md and running-code.md.

Steps

  1. open <url>, then snapshot to get refs.
  2. Interact using refs.
  3. Take a new snapshot after navigation or a DOM change, because refs can change.
  4. close when done.

Outputs

After each command a snapshot is written as YAML under .playwright-cli/, with a timestamped name. Pass --filename= when the file is a workflow result. Named sessions run isolated contexts with separate cookies, storage and history.

Setup

The skill states that it needs the Playwright MCP server (npx @playwright/mcp@latest) configured in .mcp.json.

Gotchas

On single-page apps data-testid values can change between renders, so prefer role-based selectors such as getByRole. Each run starts with a fresh context, so use state-save and state-load to keep auth cookies between runs.

On this page