playwright
Use when the task requires automating a real browser from the terminal (navigation, form filling, snapshots, screenshots, data extraction, UI-flow debugging) via `playwright-cli` invoked through npx i
SKILL.mdskills/playwright/SKILL.md
GitHubPlaywright CLI Skill
Drive a real browser from the terminal using Playwright CLI. No scripts are bundled with this skill — everything runs via npx in the project directory.
Usage
Use npx directly — no global install needed:
npx --package @playwright/cli playwright-cli --help
For convenience, add a script in the project's scripts/ directory if you use it often:
scripts/pwcli.sh:
#!/usr/bin/env bash
exec npx --yes --package @playwright/cli playwright-cli "$@"
Or create a project-local alias / npm script (package.json):
"scripts": { "pw": "npx --package @playwright/cli playwright-cli" }
Core workflow
- Open the page:
npx playwright-cli open https://example.com - Snapshot to get stable element refs:
npx playwright-cli snapshot - Interact using refs from the latest snapshot:
npx playwright-cli click e3 - Re-snapshot after navigation or significant DOM changes
- Capture artifacts:
npx playwright-cli screenshot
Guardrails
- Always snapshot before referencing element ids like
e12 - Re-snapshot when refs seem stale
- Use
--headedwhen a visual check will help - When you do not have a fresh snapshot, use placeholder refs like
eXand say why - Default to CLI commands, not Playwright test specs
Cross-references
- screenshot — Screenshot captures complement Playwright automation for visual verification.
- portable-self-contained — Sections 3 (Node.js) and 6 (scripts/ folder) cover project-local tooling setup. Playwright should be called via npx or a project-local script, never bundled with the skill.
- skill-loader — Apply the capped selection policy when deciding which browser-automation support skills should also be active.