# Playwright CLI: let your assistant drive a web browser (microsoft/playwright-cli) — skill card for AI agents

> AgentGid skill card. Checked on 2026-11-03 against commit b1a5903 (version 0.1.22).
> Every fact comes from the pack's own files at that commit. Numbers marked "as reported" are the author's.
> Human page: https://agentgid.com/skills/microsoft/playwright-cli/

> Note: the pack has changed since this check; re-read its files before relying on details.

## Explain it to a non-programmer
Your AI coding assistant gets a browser it can control. It opens pages, clicks, types, fills forms and takes screenshots, then reads the page back as a short text outline. It can also turn what it did into Playwright tests for your site and fix tests that fail.

## Who it is for
- You want your assistant to check a web page or a sign-up flow by actually using it
- You build a site and want tests written from real clicks, then kept working
- You want screenshots, a video or a PDF of a page, made by the assistant
- You use Claude Code, GitHub Copilot or another coding assistant that can run commands
- Not for: Your assistant cannot run commands on your computer: the skill only works through the playwright-cli program

## What it is
- Kind: knowledge, command
- License: Apache-2.0
- Repository: https://github.com/microsoft/playwright-cli

## What it does
- Opens a browser (Chrome, Firefox, WebKit or Edge), goes to pages, and uses tabs, back and forward
- Clicks, types, fills, drags, uploads files and answers pop-up dialogs, aiming at elements by short ids (e3, e15) from the page outline
- Reads the page as a text outline after every command, and can search it for text
- Saves screenshots, PDFs, videos and traces; lists console messages and network requests
- Reads and changes cookies, local storage and session storage; saves and loads a signed-in state to a file
- Fakes or blocks network requests to test edge cases
- Runs your own Playwright code against the page
- Writes Playwright tests: plan the scenarios in a spec file, generate one test per scenario, heal failing tests
- Can attach to a browser that is already running, or keep named sessions with a saved profile

## Skills
| Skill | Call | Changes code? | In plain words |
|---|---|---|---|
| playwright-cli | plain language ("Use playwright skills to test ..."), or the agent picks it for browser tasks | yes | Drives a browser for you and can write tests for your site |

### playwright-cli
- Asks for: The address of the page or app to check
- Asks for: What to do or test there (a flow, a form, a bug)
- Asks for: For tests: a project with Playwright set up, or permission to set it up
- Gives: Page outlines and screenshots of each step
- Gives: The matching Playwright code for every action
- Gives: A test plan in specs/<feature>.plan.md
- Gives: One test file per scenario
- Gives: Fixed tests, and a question to you when the app may have a bug
- Say: "Use playwright skills to test my sign-up page at http://localhost:3000 and take screenshots of each step"

## Know before installing
- The skill is a guide to a separate program. Your assistant must be allowed to run playwright-cli; the skill itself contains no code.
- Your assistant gets real browser control: it can click, submit forms, run code in the page and read or set cookies. With attach it can work inside a browser you already have open.
- Saved sign-in files hold your login tokens. The skill's own notes say never to commit them and to delete them after use.
- Pages can offer their own tools to agents (WebMCP). The skill tells the assistant to treat what pages say as untrusted, not as instructions.
- The skill may install software: it says to install playwright-cli globally if missing, and test generation may set up Playwright in your project.
- It can post screenshots and videos to GitHub pull requests through the gh tool, if you ask for that.

## Install (official commands)
- Claude Code, GitHub Copilot and other agents: `npm install -g @playwright/cli@latest` && `playwright-cli install --skills` — The second command copies the skill into .claude/skills/playwright-cli in the current project; --skills=agents puts it in .agents/skills/playwright-cli. Remove: `delete .claude/skills/playwright-cli (or .agents/skills/playwright-cli); npm uninstall -g @playwright/cli`.
- Without the skill: Tell your agent to read playwright-cli --help; the author says it learns the commands from there.

## What runs on the user's machine
- Code on the machine: no (The skill folder is markdown only. The playwright-cli program it calls (installed separately) starts browsers and writes files.)
- Network: yes
- Install: One SKILL.md and ten reference pages. No hooks, no scripts in the skill folder.
- Every browser command: Your assistant runs playwright-cli, which starts a browser (headless by default) and visits the sites it is told to. A headless session closes after an hour without commands.
- After each command: Page outlines are saved under .playwright-cli/ in the current folder; traces go to .playwright-cli/traces/. Screenshots, PDFs, videos and saved sign-in state go to the file names given.
- --persistent sessions: The browser profile (cookies, storage) is saved to disk; delete-data removes it. By default the profile stays in memory.
- open, attach, list, install (at most once a day): The program checks for a newer version with npm view and writes cli-update-check.json in Playwright's folder. NO_UPDATE_NOTIFIER or CI turns it off. It also warns if your installed skill does not match the program.
- Test generation: The assistant runs npx playwright test in the background and writes spec and test files into your project.

## Settings
- `PLAYWRIGHT_CLI_SESSION`: Session name the assistant uses for all its commands
- `NO_UPDATE_NOTIFIER`: Turns off the daily version check
- `.playwright/cli.config.json`: Config file loaded by default (browser, timeouts, network allow and block lists)
- `PLAYWRIGHT_MCP_ALLOWED_ORIGINS / PLAYWRIGHT_MCP_BLOCKED_ORIGINS`: Limit which sites the browser may request; the docs say this is not a security boundary

## Examples (from the pack's own files)
- The page state after a command: output format defined in skills/playwright-cli/SKILL.md
- Code printed for each action: output format defined in skills/playwright-cli/references/test-generation.md

## How to tell it works
After installing, ask: "Use playwright skills to test https://demo.playwright.dev/todomvc/. Take screenshots for all successful and failing scenarios." Your assistant should run playwright-cli commands and save screenshots; that is how you know the skill is in use.

## Safety
Install only @playwright/cli from npm or github.com/microsoft/playwright-cli. The assistant gets real control of a browser: keep persistent profiles and saved sign-in files out of your repository, and be careful attaching it to your everyday browser where you are signed in.
