-
Notifications
You must be signed in to change notification settings - Fork 72
Description
Problem
When using playwright-cli on a system without Google Chrome installed, the default configuration fails with an unclear error message:
Error: browserType.launchPersistentContext: Chromium distribution 'chrome' is not found at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
Run "npx playwright install chrome"
The suggested fix (npx playwright install chrome) doesn't work because it installs browsers for a different playwright version than what @playwright/cli uses internally.
Environment
- macOS (Apple Silicon)
@playwright/[email protected]installed globally via npm- No Google Chrome installed
Root Cause
The CLI defaults to using the chrome channel, which requires Google Chrome to be installed at a specific path. The bundled Chromium browser is available but not used by default.
Workaround
Setting the PLAYWRIGHT_MCP_BROWSER environment variable works:
PLAYWRIGHT_MCP_BROWSER=chromium playwright-cli open https://example.comHowever, this workaround is not documented in --help or the README.
Additional Issue: Browser Version Mismatch
When trying to install browsers, npx playwright install chromium installs for a different playwright version (e.g., 1.58.0) than what @playwright/cli uses (1.59.0-alpha). This causes "browser not installed" errors even after running the suggested install command.
The correct way to install browsers is:
/path/to/node_modules/@playwright/cli/node_modules/playwright/cli.js install chromiumThis is not intuitive and not documented.
Suggestions
- Better default behavior: Fall back to bundled
chromiumif thechromechannel is not available, rather than failing - Clearer error message: Include the
PLAYWRIGHT_MCP_BROWSER=chromiumworkaround in the error message - Documentation: Document the
PLAYWRIGHT_MCP_BROWSERenvironment variable in the README and--helpoutput - Browser installation: Document how to install browsers for the specific playwright version bundled with the CLI, or make
npx playwright installwork correctly
Reproduction Steps
- Install
@playwright/cliglobally:npm install -g @playwright/cli@latest - Ensure Google Chrome is not installed (or rename the app temporarily)
- Run:
playwright-cli open https://example.com - Observe the error
Expected Behavior
Either:
- The CLI should fall back to bundled Chromium automatically, or
- The error message should clearly explain how to use
PLAYWRIGHT_MCP_BROWSER=chromium