playwright-cli

Automate browser interactions and Playwright test workflows through a command-line interface.

13|17|Updated Jan 30, 2025
One-click install
npx skills add https://github.com/CodeWithSally/CodeWithSally-Apex-English --skill playwright-cli-codewithsally
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: playwright-cli
Source: https://github.com/CodeWithSally/CodeWithSally-Apex-English/tree/main/Sessions/ClaudeCode/Session004/.claude/skills/playwright-cli
Command: npx skills add https://github.com/CodeWithSally/CodeWithSally-Apex-English --skill playwright-cli-codewithsally

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @playwright/cli, and includes references (resource) components.

What problem does it solve? Manually driving a browser to test web pages, debug failing Playwright tests, or capture page state is slow and repetitive. This Skill lets you control a real browser through simple CLI commands, with every action automatically generating reusable Playwright TypeScript code. ## Core Features & Use Cases - Interactive Browser Automation: Open pages, click, fill forms, drag, upload files, and manage tabs using element refs from accessibility snapshots. - Test Authoring and Debugging: Attach to paused Playwright test runs, rehearse fixes live, and copy the generated TypeScript directly into test files; supports a full plan-generate-heal spec-driven workflow. - State, Network, and Capture Tooling: Manage cookies and storage, mock network requests, record traces and annotated videos, and run arbitrary Playwright code for advanced scenarios. - Use Case: A failing CI test can be rerun with --debug=cli, attached via playwright-cli, inspected with snapshots and console logs, fixed with rehearsed locators, and verified green in one session. ## Quick Start Ask the AI to open a website with playwright-cli, take a snapshot, and click or fill elements by their refs to automate the browser task you describe.

Frequently Asked Questions about playwright-cli

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate browser interactions with playwright-cli?

Run playwright-cli open with a URL, then playwright-cli snapshot to get element refs like e5. Use commands such as click, fill, and type with those refs, and close the browser with playwright-cli close when finished.

How do I debug a failing Playwright test with playwright-cli?

Run the test with npx playwright test --debug=cli in the background and wait for the printed session name. Attach with playwright-cli attach tw-XXXX, then use snapshot, console, and requests to diagnose the failure and rehearse the fix.

Can playwright-cli connect to an already running Chrome browser?

Yes, use playwright-cli attach --cdp=chrome or --cdp=msedge after enabling remote debugging in the browser via chrome://inspect. You can also attach to any CDP endpoint URL or through the Playwright browser extension.

How do I mock network requests in Playwright from the command line?

Use playwright-cli route with a URL pattern and options like --status, --body, or --header to intercept requests. For conditional logic or response modification, use run-code with page.route in a custom function.

Does playwright-cli support multiple isolated browser sessions?

Yes, the -s flag creates named sessions with independent cookies, storage, cache, and tabs. Use playwright-cli list to see sessions, close to stop one, and close-all or kill-all for cleanup.

What are the limitations of playwright-cli video recording and tracing?

Recording and tracing add overhead to automation and can consume significant disk space. Traces capture DOM snapshots and network detail for debugging, while video produces WebM files better suited for demos and documentation.