Arkhe-claude-plugins playwright-cli
install
source · Clone the upstream repo
git clone https://github.com/joaquimscosta/arkhe-claude-plugins
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/joaquimscosta/arkhe-claude-plugins "$T" && mkdir -p ~/.claude/skills && cp -r "$T/plugins/playwright/skills/playwright-cli" ~/.claude/skills/joaquimscosta-arkhe-claude-plugins-playwright-cli && rm -rf "$T"
manifest:
plugins/playwright/skills/playwright-cli/SKILL.mdsource content
Playwright CLI
Automate browsers through shell commands via the Bash tool.
Core Workflow
Every interaction follows this pattern:
- Open a page:
playwright-cli open <url> - Snapshot to discover elements:
playwright-cli snapshot - Interact using refs from the snapshot:
playwright-cli click <ref> - Verify the result:
orplaywright-cli screenshotplaywright-cli snapshot
Always run
snapshot before interacting — element refs come exclusively from
snapshot output and become stale after navigation.
Command Reference
Navigation
| Command | Description |
|---|---|
| Open URL in new page |
| Navigate current page |
/ | Browser back/forward |
| Reload current page |
| Close the browser |
Interaction
| Command | Description |
|---|---|
| Click an element |
| Double-click an element |
| Clear field, then type text |
| Type into focused element (appends) |
/ | Toggle checkbox |
| Select dropdown option(s) |
| Hover over element |
| Drag between elements |
| Upload file(s) to file input |
| Evaluate JavaScript on page |
| Evaluate JavaScript on element |
| Accept dialog (optional prompt text) |
| Dismiss dialog |
| Resize browser window |
Output
| Command | Description |
|---|---|
| Capture PNG screenshot (page or element) |
| Accessibility tree — structured, token-efficient |
| Generate PDF of the page |
Important:
resolves relative to the working directory, NOT--filename. When usingoutputDir, always prepend the project's--filenamevalue (checkoutputDir; defaults to.playwright/cli.config.json). Example:.playwright-cliplaywright-cli screenshot --filename=<outputDir>/my-screenshot.png
Tabs
| Command | Description |
|---|---|
| List open tabs |
| Open new tab |
| Switch to tab |
| Close tab |
Keyboard
playwright-cli press Enter # Enter, Tab, Escape, ArrowDown, etc. playwright-cli keydown Shift # Hold key down playwright-cli keyup Shift # Release key
Mouse
playwright-cli mousemove 150 300 # Move to coordinates playwright-cli mousedown [button] # Press button (left/right) playwright-cli mouseup [button] # Release button playwright-cli mousewheel 0 100 # Scroll (deltaX deltaY)
Sessions
- Default session — all commands share one session automatically
- Named sessions —
for parallel browsersplaywright-cli -s=<name> open <url> - List sessions —
playwright-cli list - Close one —
playwright-cli -s=<name> close - Close all —
playwright-cli close-all - Force kill —
playwright-cli kill-all - Persistent profile —
playwright-cli open <url> --persistent - Custom profile —
playwright-cli open <url> --profile=/path/to/dir - Delete data —
orplaywright-cli delete-dataplaywright-cli -s=<name> delete-data - Environment variable —
PLAYWRIGHT_CLI_SESSION=my-project
Configuration
playwright-cli open <url> --browser=chromium # chromium (default), firefox, webkit, chrome, msedge playwright-cli open <url> --headed # Visible browser window playwright-cli open <url> --config=config.json # Custom config file playwright-cli open <url> --extension # Connect via browser extension
Create
.playwright/cli.config.json in the project for persistent settings:
{ "browser": { "browserName": "chromium", "launchOptions": { "headless": true } }, "outputDir": ".playwright-cli", "timeouts": { "action": 5000, "navigation": 60000 } }
Other options:
network.allowedOrigins, network.blockedOrigins, saveVideo.
Environment variables use PLAYWRIGHT_MCP_ prefix (e.g., PLAYWRIGHT_MCP_BROWSER=firefox).
Common Pitfalls
- Interacting without snapshot — refs are unknown until
runssnapshot - Stale refs after navigation — re-run
aftersnapshot
, link clicks, or form submissionsgoto - fill vs type —
clears the field first;fill
appends to current contenttype - Stuck sessions — run
to force-close all browsersplaywright-cli kill-all
Resources
- EXAMPLES.md — Multi-step workflow examples
- TROUBLESHOOTING.md — Error diagnosis and fixes
- references/request-mocking.md — Intercept, mock, and block network requests
- references/running-code.md — Execute arbitrary Playwright code via
run-code - references/session-management.md — Named sessions, isolation, concurrent browsers
- references/storage-state.md — Cookies, localStorage, sessionStorage management
- references/test-generation.md — Generate Playwright test code from CLI actions
- references/tracing.md — Capture execution traces for debugging
- references/video-recording.md — Record browser sessions as WebM video