playwright-cli

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

Updated Jul 21, 2026
One-click install
npx skills add https://github.com/masakinihirota/2026src-ni --skill playwright-cli-masakinihirota
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: playwright-cli
Source: https://github.com/masakinihirota/2026src-ni/tree/main/.agents/skills/playwright-cli
Command: npx skills add https://github.com/masakinihirota/2026src-ni --skill playwright-cli-masakinihirota

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 an AI agent control a real browser session via the playwright-cli command line, producing snapshots, generated test code, traces, and videos without writing boilerplate automation scripts. ## Core Features & Use Cases - Interactive Browser Automation: Open pages, click, fill forms, drag, upload files, and inspect accessibility snapshots using element refs, CSS selectors, or Playwright locators. - Test Authoring and Healing: Run Playwright tests with --debug=cli, attach to the paused session, rehearse fixes, and copy the auto-generated TypeScript code directly into test files following a plan-generate-heal workflow. - Session, Storage, and Network Control: Manage multiple isolated named sessions, save and restore cookies/localStorage state, and mock or block network requests with route rules. - Use Case: A failing CI test needs diagnosis. 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 back into the test. ## Quick Start Ask the agent to open a website with playwright-cli, take a snapshot of the page, and click or fill elements by their snapshot refs.

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 accessibility snapshot. Commands like click, fill, and type target elements such as e5, and each command returns an updated page snapshot.

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 paused page can be explored with snapshots, console logs, and network requests to find the cause.

Can playwright-cli generate Playwright test code automatically?▼

Yes, every playwright-cli action prints the equivalent Playwright TypeScript code, such as page.getByRole locators. You collect these generated lines into a test file and add assertions manually using matchers like toBeVisible or toHaveText.

Does playwright-cli support multiple isolated browser sessions?▼

Yes, the -s flag creates named sessions with independent cookies, localStorage, cache, and tabs. Sessions can run concurrently, use persistent profiles, and be listed, closed, or cleaned up with list, close-all, and delete-data commands.

How do I mock network requests during browser automation?▼

Use playwright-cli route with a URL pattern to return custom status codes, JSON bodies, or headers, and unroute to remove rules. For conditional logic or response modification, run-code executes arbitrary Playwright routing functions.

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 with DOM snapshots and network details, tracing is more appropriate than video.