playwright-cli

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

Updated Dec 9, 2025
One-click install
npx skills add https://github.com/Aki2022/skills --skill playwright-cli-aki2022
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: playwright-cli
Source: https://github.com/Aki2022/skills/tree/main/playwright-cli
Command: npx skills add https://github.com/Aki2022/skills --skill playwright-cli-aki2022

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 session from the command line—navigating, clicking, filling forms, mocking network requests, and generating Playwright test code from your actions. ## Core Features & Use Cases - Interactive Browser Automation: Open pages, click elements by snapshot refs, fill forms, manage tabs, cookies, and storage, and capture screenshots, PDFs, traces, and videos. - Playwright Test Workflows: Run and debug tests via --debug=cli, attach to paused sessions, and follow a spec-driven plan → generate → heal workflow where every CLI action emits ready-to-paste TypeScript test code. - Network Mocking & DevTools: Intercept and mock requests, inspect console output and network traffic, and run arbitrary Playwright code for geolocation, permissions, frames, and downloads. - Use Case: A failing CI test can be rerun with npx playwright test --debug=cli, attached via playwright-cli attach tw-XXXX, inspected with snapshots, and fixed by copying the generated locator code back into the test file. ## Quick Start Ask the AI to open a website with playwright-cli, take a snapshot of the page, and click or fill elements using the refs from that snapshot.

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, type, and press cover common interactions, and each action prints the equivalent Playwright 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, letting you snapshot the page, inspect console output, and rehearse fixes whose generated code you paste back into the test.

Can playwright-cli mock network requests during testing?

Yes, the route command intercepts URL patterns and returns custom status codes, bodies, or headers, while unroute removes them. For conditional logic, response modification, or simulated failures, use run-code with page.route handlers.

Does playwright-cli support multiple isolated browser sessions?

Yes, the -s flag creates named sessions with independent cookies, storage, cache, and tabs. You can list sessions, close them individually or all at once, persist profiles to disk, and attach to externally running Chrome or Edge instances via CDP.

What are the limitations of playwright-cli video recording?

Video recording produces WebM files and adds slight overhead to automation, with large recordings consuming significant disk space. For debugging that needs DOM snapshots and network details, tracing is more appropriate than video.