From dfa5b43e059add6bee9415903686cc6ba8e05e39 Mon Sep 17 00:00:00 2001 From: Toto Leung Date: Tue, 10 Nov 2026 17:15:24 +0800 Subject: [PATCH] docs(readme): require playwright 1.59+ for the local cli fallback --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fc3a26f..bdaabc4 100644 --- a/README.md +++ b/README.md @@ -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 ...` 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 ` 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: