playwright-cli

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

1|Updated Sep 15, 2026
One-click install
npx skills add https://github.com/amoai-tech/mdeai --skill playwright-cli-amoai-tech
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: playwright-cli
Source: https://github.com/amoai-tech/mdeai/tree/main/.claude/skills/playwright-cli
Command: npx skills add https://github.com/amoai-tech/mdeai --skill playwright-cli-amoai-tech

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Manually driving a browser to test web pages, debug failing Playwright tests, or capture UI evidence is slow and repetitive. This Skill lets you control a real browser session 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, navigate tabs, manage cookies and storage, and take snapshots using element refs from accessibility snapshots. - Test Authoring and Healing: Run Playwright tests in debug mode, attach to the paused session, rehearse fixes live, and copy the generated TypeScript back into test files following a plan-generate-heal workflow. - Debugging and Evidence Capture: Record traces, videos with chapter overlays, console logs, and network requests, plus mock API responses for controlled testing. - Use Case: A failing checkout test needs diagnosis. Run it with --debug=cli, attach playwright-cli to the paused session, inspect the snapshot and network requests, rehearse the corrected click, and paste the generated locator code into the test. ## Quick Start Open my staging site in a browser with playwright-cli, take a snapshot, and fill in the login form to verify the sign-in flow works.

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 from the command line?

Use playwright-cli to open a browser, navigate to a URL, and interact with elements using refs from the page snapshot. Commands like click, fill, and type map directly to Playwright actions, and each command prints the equivalent TypeScript code.

How to debug a failing Playwright test interactively?

Run the test with npx playwright test --debug=cli in the background, then attach with playwright-cli attach using the printed session name. The test pauses at the start so you can step through, inspect snapshots, and rehearse fixes live.

Can playwright-cli mock network requests during testing?

Yes, the route command intercepts URL patterns and returns custom status codes, JSON bodies, or headers. For conditional logic or response modification, use run-code with page.route to implement advanced mocking.

Does playwright-cli support multiple isolated browser sessions?

Yes, the -s flag creates named sessions with independent cookies, storage, cache, and tabs. You can run sessions concurrently, list them, and attach to external Chrome or Edge instances via CDP.

How do I save and reuse login state in Playwright?

Use playwright-cli state-save after logging in to write cookies and localStorage to a JSON file. Later, state-load restores that state so subsequent sessions skip the login flow entirely.

What are the limitations of playwright-cli run-code?

The run-code command accepts only a single async function expression and does not support import, export, or require syntax. For reusable logic, save the function to a file and pass it with --filename.