Installation
Prerequisites
- Node.js 20 or newer
- A coding agent: Claude Code, GitHub Copilot, or similar
Global installation
npm install -g @playwright/cli@latest
playwright-cli --help
Using the version in your project
If Playwright is already a dependency of the project, the CLI is available through it — no global install needed:
npx --no-install playwright --version # check that a local Playwright exists
npx playwright cli --help
Everywhere these docs write playwright-cli <command>, npx playwright cli <command> works the
same way.
Initializing a workspace
playwright-cli install
This creates a .playwright directory in the current working directory, adds it to .gitignore,
and downloads the configured browser if it is missing.
Installing skills
Coding agents like Claude Code and GitHub Copilot use locally installed skills for richer context about available commands and workflows:
playwright-cli install --skills # same as --skills=claude
playwright-cli install --skills=claude # .claude/skills/playwright-cli
playwright-cli install --skills=agents # .agents/skills/playwright-cli
playwright-cli install --skills -g # install into the home directory
--global (alias -g) installs the skill into ~/.claude/skills or ~/.agents/skills so it is
available in every project. It requires --skills and skips the workspace initialization.
See Skills for what the skill contains.
Installing browsers
The CLI downloads a browser automatically on first use. To install explicitly:
playwright-cli install-browser # install the browsers this version needs
playwright-cli install-browser firefox # install one specific browser
playwright-cli install-browser --with-deps # install with system dependencies
Install options
| Flag | Description |
|---|---|
--with-deps | Install system dependencies (Linux) |
--dry-run | Preview what would be installed |
--list | List available browsers from all installations |
--force | Force reinstall even if already present |
--only-shell | Only install Chromium headless shell |
--no-shell | Skip Chromium headless shell |
Skills-less operation
You can also point your agent at the CLI directly and let it discover commands on its own:
Test the "add todo" flow on https://demo.playwright.dev/todomvc using playwright-cli.
Check playwright-cli --help for available commands.
Environment setup
Configure your coding agent to use a specific session:
PLAYWRIGHT_CLI_SESSION=todo-app claude .
Next steps
- Quick Start — try the CLI hands-on
- Snapshots — how element refs work
- Command Reference — every command, grouped
- Configuration — headless mode, browser selection, profiles