playwright-cli

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

Updated Mar 27, 2026
One-click install
npx skills add https://github.com/gmackie/agent-skills --skill playwright-cli-gmackie
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: playwright-cli
Source: https://github.com/gmackie/agent-skills/tree/main/skills/playwright-cli
Command: npx skills add https://github.com/gmackie/agent-skills --skill playwright-cli-gmackie

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 error-prone. This Skill lets an agent control a real browser session through playwright-cli commands, turning every action into reproducible Playwright TypeScript code. ## Core Features & Use Cases - Browser Automation: Open pages, click, fill forms, navigate tabs, manage cookies and storage, and capture snapshots, screenshots, PDFs, traces, and videos. - Test Plan, Generate, and Heal: Explore an app through a seed test, write spec files, generate Playwright test files from recorded actions, and debug or repair failing tests via --debug=cli attach sessions. - Network and DevTools Control: Mock or block requests with route rules, inspect console output and network requests, and run arbitrary Playwright code for geolocation, permissions, and media emulation. - Use Case: A QA engineer asks the agent to reproduce a failing checkout flow; the agent attaches to the paused test, inspects the snapshot and console, rehearses the fix, and pastes the generated locator code back into the test file. ## Quick Start Ask the agent to open a website with playwright-cli, take a snapshot, and click through a login form while generating the corresponding Playwright test code.

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 to start a browser, then use snapshot to get element refs and commands like click, fill, and goto to interact with the page. Each command prints the equivalent Playwright TypeScript code you can reuse in tests.

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

Run the test with npx playwright test --debug=cli in the background, wait for the debugging instructions with a session name, then attach using playwright-cli attach tw-XXXX. You can inspect snapshots, console output, and network requests while the test is paused.

Can playwright-cli mock network requests?▼

Yes, playwright-cli route intercepts URL patterns and can return custom status codes, JSON bodies, or headers. For conditional logic or response modification, use run-code with page.route to inspect requests and fulfill them dynamically.

Does playwright-cli support multiple browser sessions?▼

Yes, the -s flag creates named sessions with isolated 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 browsers does playwright-cli support?▼

The open command supports chrome, firefox, webkit, and msedge via the --browser flag, plus mobile device emulation with --mobile or --device. You can also attach to running Chrome or Edge instances over CDP.

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

cmd.exe and PowerShell treat the ampersand as a command separator, truncating URLs before playwright-cli runs. Escape ampersands with a caret in cmd.exe or use the --% stop-parsing token in PowerShell.