playwright-cli: Claude Code Skill & Agent Tool
An open-source skill by microsoft (opens in a new tab), published in the microsoft/playwright-cli (opens in a new tab) repository on GitHub. Microsoft's official Playwright skill: open pages, interact through accessibility snapshots, take screenshots and work with Playwright tests straight from the terminal.
Install playwright-cli
Requires Node.jsnpx skills add microsoft/playwright-cli --skill playwright-cliRun this command in your project terminal to install this skill for Claude Code.
What this skill does
playwright-cli is Microsoft's official skill for browser automation from the command line. Instead of writing a script first, your agent opens a browser, navigates to a page and reads an accessibility snapshot in which every interactive element has a short reference. It then clicks, types, fills fields, presses keys, uploads or drops files and takes screenshots by pointing at those references, which keeps interactions reliable and the context small.
The command set is broad: navigation and tabs, keyboard and mouse control, saving pages, cookies, localStorage and sessionStorage, device emulation, network inspection and DevTools features. The agent can search a snapshot for text or a pattern, read attributes that are not visible, and generate a Playwright locator for any element.
It also bridges into test automation. A recording mode captures your actions in the browser and prints them as Playwright code, annotations label each step for review, and a dashboard lets you mark up a page so the agent receives your notes with the screenshot. Use it with Claude Code to reproduce bugs, check a deployment, scrape pages that need interaction, or turn a manual flow into a Playwright test.
Key Capabilities
- Accessibility snapshots with element refs for reliable clicks and typing
- Navigation, tabs, keyboard, mouse, file uploads and screenshots
- Cookies, localStorage, sessionStorage, emulation, network and DevTools
- Records your actions and prints them as Playwright test code
- Generates a Playwright locator for any element
How to use with Claude Code & AI Agents
Install the skill
Run the command above at the root of your project. The CLI asks which agents to set up — Claude Code, Cursor and other supported agents — and adds playwright-cli to the project, so teammates who pull the repository get it too. Add-gto install it for your user account across every project.Open a new agent session
Start a fresh Claude Code session in that project so the agent loads the new skill. Have ready: Playwright (npx playwright cli) or the global @playwright/cli package.Ask in plain words
Describe the task, for example:“Open our staging site, log in with the test account and check that checkout works.”The agent matches your request to the skill's description and follows its SKILL.md instructions step by step. Read them on GitHub before using the skill on a system that matters.