playwright-cli

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

Updated Jan 31, 2023
One-click install
npx skills add https://github.com/Briian3306/Transporte --skill playwright-cli-briian3306
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: playwright-cli
Source: https://github.com/Briian3306/Transporte/tree/main/ibarra-app/.agents/skills/playwright-cli
Command: npx skills add https://github.com/Briian3306/Transporte --skill playwright-cli-briian3306

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 through playwright-cli commands, turning every action into reusable Playwright TypeScript code. ## Core Features & Use Cases - Browser Automation: Open pages, click, fill forms, navigate tabs, and capture snapshots using element refs from accessibility snapshots. - Test Authoring and Healing: Explore an app, generate Playwright test specs and test files from recorded actions, and debug failing tests by attaching to paused test sessions. - Network and Storage Control: Mock API requests, manage cookies and localStorage, save and restore authentication state, and record traces or videos of sessions. - Use Case: A developer has a failing Playwright test. Run it with --debug=cli, attach playwright-cli to the paused session, inspect the live page with snapshots and console logs, rehearse the fix, and paste the generated code 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 using the refs shown in the 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 with playwright-cli?▼

Run playwright-cli open to launch a browser, then use playwright-cli snapshot to get element refs like e5. Interact with commands such as playwright-cli click e5 or playwright-cli fill e1 "text", and close the session with playwright-cli close.

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 snapshots, console logs, and network requests, and every action generates TypeScript code to paste into the test.

Can playwright-cli mock network requests in the browser?▼

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

Does playwright-cli support multiple browser sessions at once?▼

Yes, the -s flag creates named sessions with isolated cookies, storage, cache, and tabs. Sessions can run concurrently, be listed with playwright-cli list, and cleaned up with close-all or kill-all.

How do I save and reuse login state in Playwright browser automation?▼

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, which skips the login flow entirely.

What browsers does playwright-cli support?▼

playwright-cli open supports Chromium, Chrome, Firefox, WebKit, and Edge via the --browser flag, plus mobile device emulation. It can also attach to running Chrome or Edge instances over CDP or through the Playwright browser extension.