
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- Repository
- zebbern/claude-code-guide4.7k
- 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
- Always
snapshotfirst, identify element refs before interacting; never guess ref numbers - Use
fillfor inputs,clickfor buttons,typesends keystrokes one-by-one,fillreplaces the entire value - Named sessions for parallel work,
-s=nameisolates cookies, storage, and tabs per session - Save auth state,
state-save auth.jsonafter login,state-load auth.jsonto skip login next time - Trace before debugging,
tracing-startbefore the failing step, not after run-codefor advanced scenarios, when CLI commands aren't enough, drop into full Playwright API- Clean up sessions,
closeorclose-allwhen done;kill-allfor zombie processes - Descriptive filenames,
screenshot --filename=checkout-step3.pngnotscreenshot - Mock external APIs only, use
routeto intercept third-party services, not your own app - Persistent profiles for stateful flows,
--persistentkeeps cookies and storage across restarts


