Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -422,18 +422,21 @@ playwright-cli kill-all # forcefully kill all browser processes

### Local installation

If global `playwright-cli` command is not available, try a local version via `npx playwright cli`:
If global `playwright-cli` command is not available, try a local version via `npx playwright cli`. The `cli` subcommand ships with Playwright 1.59 and newer — an older local Playwright still answers `--version`, but `npx playwright cli <command> ...` fails with `error: unknown command 'cli'`. Do not use `cli --help` as the probe: on those versions it prints the root help and exits 0.

```bash
npx --no-install playwright --version
npx --no-install playwright --version # informational: any installed version answers this
npx --no-install playwright cli list # capability probe — this one decides
```

When local version is available, use `npx playwright cli` in all commands. Otherwise, install `playwright-cli` as a global command:
Run the checks from the directory that declares the Playwright dependency (the workspace root in a monorepo). When `cli list` succeeds, keep using `npx --no-install playwright cli <command>` for the remaining commands; on Playwright 1.60 and newer, `npx --no-install playwright cli --help` lists the commands the installed version supports. When `cli list` fails with `error: unknown command 'cli'`, the local Playwright predates 1.59; when npx reports that no local Playwright exists, there is none to use. Install the global command in either case:

```bash
npm install -g @playwright/cli@latest
```

Root commands like `npx playwright open` or `npx playwright screenshot` are separate commands with different behavior; they are not substitutes for `npx playwright cli`.

## Configuration file

The Playwright CLI can be configured using a JSON configuration file. You can specify the configuration file using the `--config` command line option:
Expand Down