playwright-cli

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

31|2|Updated Mar 21, 2026
One-click install
npx skills add https://github.com/letuhao/lore-weave --skill playwright-cli-letuhao
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: playwright-cli
Source: https://github.com/letuhao/lore-weave/tree/main/.claude/skills/playwright-cli
Command: npx skills add https://github.com/letuhao/lore-weave --skill playwright-cli-letuhao

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 page state is slow and repetitive. This Skill lets an AI agent control a real browser session through simple CLI commands, turning every action into reusable Playwright TypeScript code. ## Core Features & Use Cases - Interactive Browser Automation: Open pages, click elements, fill forms, navigate tabs, and capture accessibility snapshots using element refs from the page snapshot. - Test Authoring and Healing: Follow a plan-generate-heal workflow where CLI actions emit Playwright TypeScript that is assembled into test files, then debugged via --debug=cli attach sessions. - Storage, Network, and Session Control: Manage cookies, localStorage, sessionStorage, mock network requests, run multiple isolated named sessions, and record traces or videos. - Use Case: A failing Playwright test needs diagnosis. Run it with --debug=cli, attach playwright-cli to the paused session, inspect the snapshot and console, rehearse the corrected interaction, and paste the generated locator code back into the test. ## Quick Start Ask the AI to open a website with playwright-cli, take a snapshot, and click or fill elements by their snapshot refs to automate the browser task you describe.

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 playwright-cli snapshot to get element refs like e5. Interact using commands such as click, fill, and type with those refs, and close the browser when finished.

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

Run the test with npx playwright test --debug=cli in the background, then attach with playwright-cli attach using the printed session name. Inspect the snapshot, console, and network requests, and copy the generated TypeScript code into your fixed test.

Can playwright-cli run multiple browser sessions at once?

Yes, use the -s flag to create named sessions with isolated cookies, storage, and tabs, for example playwright-cli -s=auth open. List sessions with playwright-cli list and stop them with close or close-all.

Does playwright-cli support mocking network requests?

Yes, the route command intercepts URL patterns and returns custom status codes, bodies, or headers, such as playwright-cli route "**/api/users" --body with JSON. Use unroute to remove routes and run-code for conditional mocking logic.

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, restore it with playwright-cli state-load auth.json before navigating, skipping the login flow entirely.

What are the limitations of playwright-cli snapshots?

Snapshots show the accessibility tree but omit attributes like id, class, and data-* values. Use playwright-cli eval with a function like el => el.id on an element ref to inspect those hidden DOM properties.