What This Skill Does
Drive real browsers from the terminal using playwright-cli. Automates navigation, form filling, snapshots, screenshots, and data extraction via CLI commands with a bundled wrapper script.
Getting Started
Prerequisites:
# Verify npx available
command -v npx
# Install Node.js/npm if missing
node --version
npm --version
Bundled Wrapper:
export CODEX_HOME="${CODEX_HOME:-$HOME/.codex}"
export PWCLI="$CODEX_HOME/skills/playwright/scripts/playwright_cli.sh"
Key Features
Core Workflow
Example:
"$PWCLI" open https://example.com
"$PWCLI" snapshot
"$PWCLI" click e3
"$PWCLI" screenshot
When to Re-Snapshot
After:
- Navigation
- Clicking elements that change UI
- Opening/closing modals
- Tab switches
Usage Examples
Form Automation
"$PWCLI" open https://example.com/form
"$PWCLI" snapshot
"$PWCLI" fill e1 "[email protected]"
"$PWCLI" fill e2 "password123"
"$PWCLI" click e3
"$PWCLI" snapshot
Multi-Tab Work
"$PWCLI" tab-new https://example.com
"$PWCLI" tab-list
"$PWCLI" tab-select 0
"$PWCLI" snapshot
Debug with Traces
"$PWCLI" open https://example.com --headed
"$PWCLI" tracing-start
# ...interactions...
"$PWCLI" tracing-stop
Best Practices
1. Always Snapshot Before Refs
Never reference e12 without a fresh snapshot.
2. Re-Snapshot When Stale
If command fails due to missing ref, snapshot again.
3. Use Headed Mode for Visual Checks
"$PWCLI" open https://example.com --headed
4. Prefer Explicit Commands
Use direct commands over eval and run-code.
5. Organize Artifacts
Save to output/playwright/ in repos.
When to Use
Use when:
- Automating browser interactions
- Testing web UIs
- Extracting data from websites
- Debugging UI flows
- Capturing screenshots/traces
Don't use when:
- Need Playwright test specs (use @playwright/test)
- Simple HTTP requests suffice
- Working with APIs only
Related Skills
- Screenshot Skill - For OS-level captures
- WebApp Testing Skill - For local app testing
Source
Organization: OpenAI
Skill Name: playwright
Description: Automate real browsers from terminal via playwright-cli or bundled wrapper script.