.agents/skills/playwright-cli/SKILL.md
Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, or extract information from web pages.
npx skillsauth add jkker/react-template playwright-cliInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
click e15, fill e5 "value") over run-code scripts.snapshot to discover element refs before acting. NEVER guess refs or write DOM queries when a snapshot would reveal the ref directly.# open new browser
playwright-cli open
# navigate to a page
playwright-cli goto https://playwright.dev
# interact with the page using refs from the snapshot
playwright-cli click e15
playwright-cli type "page.click"
playwright-cli press Enter
# take a screenshot (rarely used, as snapshot is more common)
playwright-cli screenshot
# close the browser
playwright-cli close
playwright-cli open
# open and navigate right away
playwright-cli open https://example.com/
playwright-cli goto https://playwright.dev
playwright-cli type "search query"
playwright-cli click e3
playwright-cli dblclick e7
playwright-cli fill e5 "[email protected]"
playwright-cli drag e2 e8
playwright-cli hover e4
playwright-cli select e9 "option-value"
playwright-cli upload ./document.pdf
playwright-cli check e12
playwright-cli uncheck e12
playwright-cli snapshot
playwright-cli snapshot --filename=after-click.yaml
playwright-cli eval "document.title"
playwright-cli eval "el => el.textContent" e5
playwright-cli dialog-accept
playwright-cli dialog-accept "confirmation text"
playwright-cli dialog-dismiss
playwright-cli close
playwright-cli go-back
playwright-cli go-forward
playwright-cli reload
playwright-cli press Enter
playwright-cli press ArrowDown
playwright-cli keydown Shift
playwright-cli keyup Shift
playwright-cli mousemove 150 300
playwright-cli mousedown
playwright-cli mousedown right
playwright-cli mouseup
playwright-cli mouseup right
playwright-cli mousewheel 0 100
playwright-cli screenshot
playwright-cli screenshot e5
playwright-cli screenshot --filename=page.png
playwright-cli pdf --filename=page.pdf
playwright-cli tab-list
playwright-cli tab-new https://example.com/page
playwright-cli tab-close
playwright-cli tab-close 2
playwright-cli tab-select 0
# Cookies
playwright-cli cookie-list
playwright-cli cookie-list --domain=example.com
playwright-cli cookie-get session_id
playwright-cli cookie-set session_id abc123 --domain=example.com --httpOnly --secure
playwright-cli cookie-delete session_id
playwright-cli cookie-clear
playwright-cli console
playwright-cli console warning
playwright-cli network
playwright-cli run-code "async page => await page.context().grantPermissions(['geolocation'])"
After each command, playwright-cli provides a snapshot of the current browser state.
> playwright-cli goto https://example.com
### Page
- Page URL: https://example.com/
- Page Title: Example Domain
### Snapshot
[Snapshot](.playwright-cli/page-2026-02-14T19-22-42-679Z.yml)
You can also take a snapshot on demand using playwright-cli snapshot command.
If --filename is not provided, a new snapshot file is created with a timestamp. Default to automatic file naming, use --filename= when artifact is a part of the workflow result.
playwright-cli open example.com
# same with manually specified profile directory (use when requested explicitly)
playwright-cli open example.com --profile=/path/to/profile
playwright-cli click e6
playwright-cli close # stop a named browser
playwright-cli open https://example.com/form
playwright-cli snapshot
playwright-cli fill e1 "[email protected]"
playwright-cli fill e2 "password123"
playwright-cli click e3
playwright-cli snapshot
playwright-cli close
playwright-cli open https://example.com
playwright-cli tab-new https://example.com/other
playwright-cli tab-list
playwright-cli tab-select 0
playwright-cli snapshot
playwright-cli close
playwright-cli eval "document.documentElement.outerHTML" | defuddle parse /dev/stdin --markdown
playwright-cli eval "document.documentElement.outerHTML" | defuddle parse /dev/stdin --json
The browser stack uses camoufox with anti-detection. Most bot protection can be worked through.
playwright-cli reload then re-check the snapshot.playwright-cli cookie-clear then navigate again. Bot-protection scores often reset.sleep 2 between commands.playwright-cli eval to inspect the DOM for hidden elements, iframes, or overlays.playwright-cli close then playwright-cli open.Chain related commands with && to reduce round trips and ensure sequential execution:
# Select answer and submit in one command
playwright-cli click e5 && playwright-cli click e10
# Fill multiple fields and submit
playwright-cli fill e3 "username" && playwright-cli fill e4 "password" && playwright-cli click e6
Understanding reference patterns helps with debugging and manual snapshot inspection:
f### or f<hash> (e.g., f63e71, f93e778)e### (e.g., e15, e168)Use grep_search to quickly find elements in snapshot YAML files:
# Find submit buttons in the latest snapshot
grep -i "button.*submit" .playwright-cli/page-*.yml | tail -1
# Find all text inputs
grep "type: text" .playwright-cli/page-*.yml | tail -1
If TimeoutError: locator.click: Timeout exceeded occurs, the click may be intercepted by overlays or z-index issues:
hover before click to trigger hover states that reveal clickable areas# Instead of clicking the radio input directly
playwright-cli click f63e72 # ❌ might be intercepted
# Click its container
playwright-cli click f63e71 # ✅ more reliable
Use --filename= for important checkpoints that document workflow state:
# Auto-generated timestamp (default)
playwright-cli snapshot
# Named artifact for verification
playwright-cli snapshot --filename=login-success.yml
playwright-cli snapshot --filename=form-submitted.yml
playwright-cli snapshot --filename=final-state.yml
Named snapshots are easier to reference later and serve as workflow documentation.
Many production websites log numerous console errors and warnings. Don't be alarmed by:
Console: 23 errors, 175 warnings
Focus on:
Only investigate console errors if your automation fails unexpectedly.
Take snapshots at key points to verify state transitions:
# Before action
playwright-cli snapshot --filename=before-submit.yml
# Perform action
playwright-cli click e10
# After action - verify result
playwright-cli snapshot --filename=after-submit.yml
Then use grep_search to verify expected changes:
# Check for success message
grep -i "success\|passed\|complete" after-submit.yml
# Verify score or status
grep -i "score\|status" after-submit.yml
Snapshot YAML files contain the full page structure. Use text tools to extract what you need:
# Get all button texts
grep "button" page.yml | grep "text:"
# Find elements by label
grep -A 5 "Email Address" page.yml
# Check current URL and title
head -20 page.yml
This is faster than reading entire large snapshot files when you know what you're looking for.
tools
Type-safe Zustand state management with auto-generated hooks, selectors, and actions. Use when implementing or working with Zustand stores in React apps, especially when creating new stores, adding selectors/actions, using middleware (devtools, persist, immer, mutative), or migrating from plain Zustand to get better DX with less boilerplate.
development
Vitest fast unit testing framework powered by Vite with Jest-compatible API. Use when writing tests, mocking, configuring coverage, or working with test filtering and fixtures.
development
Test-driven development with red-green-refactor loop. Use when user wants to build features or fix bugs using TDD, mentions "red-green-refactor", wants integration tests, or asks for test-first development.
testing
Manage TanStack Intent skill-to-task mappings. Use when adding, updating, or discovering agent skills from installed npm packages, or when re-syncing intent-skills after dependency updates.