Skip to content
Merged
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
29 changes: 23 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -523,12 +523,20 @@ npm install -g @playwright/cli@latest

## 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:
The Playwright CLI can be configured using a JSON or INI configuration file. You can specify the configuration file using the `--config` command line option:

```bash
playwright-cli --config path/to/config.json open example.com
```

INI files use dot-separated setting names. Pass `--config path/to/config.ini` to load a file such as:

```ini
browser.browserName=chromium
browser.launchOptions.headless=true
browser.contextOptions.viewport=1280x720
```

Playwright CLI will load config from `.playwright/cli.config.json` by default so that you did not need to specify it every time.

It also loads `~/.playwright/cli.config.json` as global defaults. Workspace or explicit config
Expand Down Expand Up @@ -669,8 +677,9 @@ The schema below lists settings used by the CLI. Session names come from `--sess

/**
* The directory for automatically named output files, for example a screenshot
* taken without an explicit file name. Defaults to .playwright-cli in the workspace.
* Files with an explicit name are resolved against the workspace root instead
* taken without an explicit file name. Defaults to .playwright-cli in the directory
* where the session was opened or attached.
* Files with an explicit name are resolved against the command's working directory instead
* and are not affected by this option.
* Relative paths are resolved against the config file's directory.
*/
Expand Down Expand Up @@ -737,7 +746,14 @@ The schema below lists settings used by the CLI. Session names come from `--sess
};

/**
* How file paths are rendered in results. Defaults to "relative" to the workspace root.
* Whether to include image parts in responses. Defaults to "allow".
* The CLI displays text only. Use "allow" or "omit" to retain screenshot file links;
* "only" makes screenshots without an explicit filename print undefined instead.
*/
imageResponses?: 'allow' | 'omit' | 'only';

/**
* How file paths are rendered in results. Defaults to "relative" to the command's working directory.
*/
filePaths?: 'relative' | 'absolute';

Expand Down Expand Up @@ -788,18 +804,19 @@ Boolean variables accept `true`/`1` or `false`/`0`. Set these variables before `
| `PLAYWRIGHT_MCP_DEVICE` device to emulate, for example: "iPhone 15" |
| `PLAYWRIGHT_MCP_EXECUTABLE_PATH` path to the browser executable. |
| `PLAYWRIGHT_MCP_EXTENSION` connect to a running browser instance (Edge/Chrome only). Requires the "Playwright Extension" to be installed. |
| `PLAYWRIGHT_MCP_FILE_PATHS` render file paths in results as "relative" to the workspace root or "absolute". Defaults to "relative". |
| `PLAYWRIGHT_MCP_FILE_PATHS` render file paths in results as "relative" to the command's working directory or "absolute". Defaults to "relative". |
| `PLAYWRIGHT_MCP_GRANT_PERMISSIONS` comma-separated list of permissions to grant to the browser context, for example "geolocation,clipboard-read,clipboard-write". |
| `PLAYWRIGHT_MCP_HEADLESS` whether to run browser in headless mode, headless by default. |
| `PLAYWRIGHT_MCP_IDLE_TIMEOUT` shut the session down after this many milliseconds without a command. Defaults to one hour for launched headless browsers, never for headed or attached ones. Pass 0 to disable. |
| `PLAYWRIGHT_MCP_IGNORE_HTTPS_ERRORS` ignore https errors |
| `PLAYWRIGHT_MCP_IMAGE_RESPONSES` image response mode: "allow", "omit" or "only", defaults to "allow". The CLI displays text only; use "allow" or "omit" to retain screenshot file links. With "only", screenshots without an explicit filename print `undefined` instead. |
| `PLAYWRIGHT_MCP_INIT_PAGE` path to TypeScript file to evaluate on Playwright page object |
| `PLAYWRIGHT_MCP_INIT_SCRIPT` path to a JavaScript file to add as an initialization script. The script will be evaluated in every page before any of the page's scripts. Use `browser.initScript` in a config file for multiple scripts. |
| `PLAYWRIGHT_MCP_ISOLATED` keep the browser profile in memory, do not save it to disk. |
| `PLAYWRIGHT_MCP_MOBILE` emulate a generic mobile device (Pixel 10 for Chromium, iPhone 17 for WebKit). Cannot be combined with `PLAYWRIGHT_MCP_DEVICE`; not supported with Firefox. |
| `PLAYWRIGHT_MCP_NO_TAB_GROUP` do not group controlled tabs when using the extension. |
| `PLAYWRIGHT_MCP_SANDBOX` whether to enable the browser sandbox. |
| `PLAYWRIGHT_MCP_OUTPUT_DIR` directory for automatically named output files. Explicit file names are resolved against the workspace root and are not affected. |
| `PLAYWRIGHT_MCP_OUTPUT_DIR` directory for automatically named output files. Explicit file names are resolved against the command's working directory and are not affected. |
| `PLAYWRIGHT_MCP_OUTPUT_MAX_SIZE` threshold for evicting old output files, in bytes. |
| `PLAYWRIGHT_MCP_PROXY_BYPASS` comma-separated domains to bypass proxy, for example ".com,chromium.org,.domain.com" |
| `PLAYWRIGHT_MCP_PROXY_SERVER` specify proxy server, for example "http://myproxy:3128" or "socks5://myproxy:8080" |
Expand Down
Loading