playwright-cli

Automate browser interactions and generate Playwright tests via command-line commands.

2|1|Updated Jun 9, 2026
One-click install
npx skills add https://github.com/zester4/zilmate --skill playwright-cli-zester4
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: playwright-cli
Source: https://github.com/zester4/zilmate/tree/main/.agents/skills/playwright-cli
Command: npx skills add https://github.com/zester4/zilmate --skill playwright-cli-zester4

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 record automation flows is slow and repetitive. This Skill lets an AI agent control a real browser through simple CLI commands, capturing snapshots, generating test code, and diagnosing failures without writing boilerplate. ## Core Features & Use Cases - Browser Automation: Open pages, click, fill forms, drag, upload files, manage tabs, and handle dialogs using element refs from accessibility snapshots. - Test Authoring & Healing: Run Playwright tests in debug mode, attach to the paused session, and turn every CLI action into copy-pasteable TypeScript test code following a plan-generate-heal workflow. - Debugging & Inspection: Capture traces, record annotated videos, mock network requests, inspect console output, and manage cookies, localStorage, and session state. - Use Case: A failing login test needs fixing. Run it with --debug=cli, attach playwright-cli to the paused session, snapshot the page to find the renamed button, rehearse the corrected click, and paste the generated locator code back into the test. ## Quick Start Use playwright-cli to open https://example.com, take a snapshot, and click the sign-in button.

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 use snapshot to get element refs like e5, and interact with click, fill, type, or press commands. Each command returns an updated page snapshot so you can chain actions without writing Playwright code.

How to debug a failing Playwright test with playwright-cli?

Run the test with npx playwright test --debug=cli in the background, then attach using playwright-cli attach with the printed session name. The paused page can be explored with snapshot, console, and requests, and every action generates corrected TypeScript code.

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

Yes, use playwright-cli attach --cdp=chrome or --cdp=msedge to connect to a running browser with remote debugging enabled, or attach --cdp=http://localhost:9222 for a CDP endpoint. Detach later without closing the external browser.

Does playwright-cli support mocking network requests?

Yes, the route command intercepts URL patterns to return custom status codes, JSON bodies, or headers, and unroute removes them. For conditional logic or response modification, use run-code with page.route for full Playwright API control.

How do I save and reuse login state in playwright-cli?

After logging in, run playwright-cli state-save auth.json to capture cookies and localStorage. Later, state-load auth.json restores the authenticated state so subsequent sessions skip the login flow entirely.

Why do URLs with query parameters fail on Windows in playwright-cli?

cmd.exe and PowerShell treat & as a command separator, truncating URLs with multiple query parameters. Escape & as ^& in cmd.exe or place --% before the command in PowerShell to pass the URL literally.