Skills

Playwright CLI

Automates browser interactions for web testing, form filling, screenshots, and data...

Install

npx skills add zebbern/claude-code-guide --skill playwright-cli -g -a claude-code -y
Category
Testing
Updated
4d ago
License
MIT
Context cost
Mediumabout 2,267 tokens
Runs scripts
No, instructions only

What it does

Automates browser interactions for web testing, form filling, screenshots, and data extraction using playwright-cli. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, extract information from web pages, mock network requests, manage browser sessions, or generate test code.

Browser Automation with playwright-cli

Comprehensive CLI-driven browser automation, navigate, interact, mock, debug, record, and generate tests without writing a single script file.

Quick Start

# Install and set up
playwright-cli install --skills
playwright-cli install-browser

# Open a browser and navigate
playwright-cli open https://playwright.dev

# Take a snapshot to see interactive elements (refs like e1, e2, e3...)
playwright-cli snapshot

# Interact using element refs from the snapshot
playwright-cli click e15
playwright-cli fill e5 "search query"
playwright-cli press Enter

# Take a screenshot
playwright-cli screenshot

# Close the browser
playwright-cli close

Golden Rules

  1. Always snapshot first, identify element refs before interacting; never guess ref numbers
  2. Use fill for inputs, click for buttons, type sends keystrokes one-by-one, fill replaces the entire value
  3. Named sessions for parallel work, -s=name isolates cookies, storage, and tabs per session
  4. Save auth state, state-save auth.json after login, state-load auth.json to skip login next time
  5. Trace before debugging, tracing-start before the failing step, not after
  6. run-code for advanced scenarios, when CLI commands aren't enough, drop into full Playwright API
  7. Clean up sessions, close or close-all when done; kill-all for zombie processes
  8. Descriptive filenames, screenshot --filename=checkout-step3.png not screenshot
  9. Mock external APIs only, use route to intercept third-party services, not your own app
  10. Persistent profiles for stateful flows, --persistent keeps cookies and storage across restarts

Command Reference

Core Interaction

Read the whole SKILL.md on GitHub

More in Testing