Playwright CLI with SKILLS
Playwright CLI vs Playwright MCP
This package provides CLI interface into Playwright. If you are using coding agents, that is the best fit.
-
CLI: Modern coding agents increasingly favor CLI–based workflows exposed as SKILLs over MCP because CLI invocations are more token-efficient: they avoid loading large tool schemas and verbose accessibility trees into the model context, allowing agents to act through concise, purpose-built commands. This makes CLI + SKILLs better suited for high-throughput coding agents that must balance browser automation with large codebases, tests, and reasoning within limited context windows.
-
MCP: MCP remains relevant for specialized agentic loops that benefit from persistent state, rich introspection, and iterative reasoning over page structure, such as exploratory automation, self-healing tests, or long-running autonomous workflows where maintaining continuous browser context outweighs token cost concerns. Learn more about Playwright MCP.
Key Features
- Token-efficient. Does not force page data into LLM.
Requirements
- Node.js 20 or newer
- Claude Code, GitHub Copilot, or any other coding agent.
Getting Started
Installation
npm install -g @playwright/cli@latest playwright-cli --help
Argument parsing and startup errors exit with code 1 and print an error message. With
--json, these errors are written to stdout as { "isError": true, "error": "..." }.
Installing skills
Claude Code, GitHub Copilot and others will use the locally installed skills.
playwright-cli install --skills playwright-cli install --skills=agents # install into .agents/skills playwright-cli install --skills --global # install into the home directory
--skills defaults to claude, installing into .claude/skills. Use agents for other agents.
Skills-less operation
Point your agent at the CLI and let it cook. It'll read the skill off playwright-cli --help on its own:
Test the "add todo" flow on https://demo.playwright.dev/todomvc using playwright-cli.
Check playwright-cli --help for available commands.
Demo
> Use playwright skills to test https://demo.playwright.dev/todomvc/.
Take screenshots for all successful and failing scenarios.
Your agent will be running commands, but it does not mean you can't play with it manually:
playwright-cli open https://demo.playwright.dev/todomvc/ --headed
playwright-cli type "Buy groceries"
playwright-cli press Enter
playwright-cli type "Water flowers"
playwright-cli press Enter
playwright-cli check e21
playwright-cli check e35
playwright-cli screenshot
Headed operation
Playwright CLI is headless by default. If you'd like to see the browser, pass --headed to open:
playwright-cli open https://playwright.dev --headed
Sessions
Playwright CLI keeps the browser profile in memory by default. Your cookies and storage state
are preserved between CLI calls within the session, but lost when the browser closes. Use
--persistent to save the profile to disk for persistence across browser restarts.
You can use different instances of the browser for different projects with sessions. Pass -s=name,
-s name or --session name to the invocation to talk to a specific browser.
playwright-cli open https://playwright.dev playwright-cli -s=example open https://example.com --persistent playwright-cli list
You can run your coding agent with the PLAYWRIGHT_CLI_SESSION environment variable:
PLAYWRIGHT_CLI_SESSION=todo-app claude .Or instruct it to prepend -s= to the calls.
A headless session shuts down on its own after an hour without commands; run open again to
start a new one. Headed browsers stay open. Use open --idle-timeout=<ms> to change the timeout,
or 0 to disable it.
Manage your sessions as follows:
playwright-cli list # list all sessions playwright-cli list --all # list sessions across all workspaces playwright-cli close-all # close all browsers in this workspace playwright-cli kill-all # forcefully kill all CLI daemon processes
Monitoring
Use playwright-cli show to open a visual dashboard that lets you see and control all running
browser sessions. This is useful when your coding agents are running browser automation in the
background and you want to observe their progress or step in to help.
playwright-cli show playwright-cli show --port=9223 # run a blocking HTTP dashboard server playwright-cli show --port=9223 --host=0.0.0.0 # listen on all interfaces
The dashboard opens a window with two views:
- Session grid — shows all active sessions grouped by workspace, each with a live screencast preview, session name, current URL, and page title. Click any session to zoom in.
- Session detail — shows a live view of the selected session with a tab bar, navigation controls (back, forward, reload, address bar), and full remote control. Click into the viewport to take over mouse and keyboard input; press Escape to release.
From the grid you can also close running sessions or delete data for inactive ones.
Commands
Core
playwright-cli open [url] # open browser, optionally navigate to url playwright-cli goto <url> # navigate to a url playwright-cli close # close the browser playwright-cli type <text> # type text into editable element playwright-cli type <text> --submit # type and press Enter playwright-cli click <ref> [button] # perform click on a web page playwright-cli click <ref> --modifiers=Shift # click with a modifier key (repeatable) playwright-cli dblclick <ref> [button] # perform double click on a web page playwright-cli dblclick <ref> --modifiers=Shift # double click with a modifier key playwright-cli fill <ref> <text> # fill text into editable element playwright-cli fill <ref> <text> --submit # fill and press Enter playwright-cli drag <startRef> <endRef> # perform drag and drop between two elements playwright-cli drop <ref> --path=<file> # drop files onto an element (from outside the page) playwright-cli drop <ref> --data="text/plain=hello" # drop data onto an element playwright-cli hover <ref> # hover over element on page playwright-cli select <ref> <val> # select an option in a dropdown playwright-cli upload <files...> # upload files through an open file chooser playwright-cli check <ref> # check a checkbox or radio button playwright-cli uncheck <ref> # uncheck a checkbox or radio button playwright-cli snapshot # capture page snapshot to obtain element ref playwright-cli snapshot --filename=f # save snapshot to specific file playwright-cli snapshot [ref] # snapshot the page or a specific element playwright-cli snapshot --depth=N # limit snapshot depth for efficiency playwright-cli find <text> # search the snapshot for text, returns matching nodes playwright-cli find --regex <pattern> # search the snapshot with a regexp playwright-cli find <text> --filename=f # save matches to a file playwright-cli find <text> --max-results=N # limit the number of matches playwright-cli eval <func> [ref] # evaluate javascript expression on page or element playwright-cli eval <func> --filename=f # save evaluation result to a file playwright-cli dialog-accept [prompt] # accept a dialog playwright-cli dialog-dismiss # dismiss a dialog playwright-cli resize <w> <h> # resize the browser window
Navigation
playwright-cli go-back # go back to the previous page playwright-cli go-forward # go forward to the next page playwright-cli reload # reload the current page
Keyboard
playwright-cli press <key> # press a key on the keyboard, `a`, `arrowleft` playwright-cli keydown <key> # press a key down on the keyboard playwright-cli keyup <key> # press a key up on the keyboard
Mouse
playwright-cli mousemove <x> <y> # move mouse to a given position playwright-cli mousedown [button] # press mouse down playwright-cli mouseup [button] # press mouse up playwright-cli mousewheel <dx> <dy> # scroll by pixels; negative dy scrolls up
The element under the mouse pointer scrolls, so use mousemove to move over it first.
Save as
playwright-cli screenshot [ref] # screenshot of the current page or element playwright-cli screenshot --filename=f # save screenshot with specific filename playwright-cli screenshot --type=webp # choose png, jpeg, or webp playwright-cli screenshot --full-page # capture the full scrollable page playwright-cli screenshot --hires # capture at full device pixel ratio playwright-cli pdf # save page as pdf playwright-cli pdf --filename=page.pdf # save pdf with specific filename
Tabs
playwright-cli tab-list # list all tabs playwright-cli tab-new [url] # create a new tab playwright-cli tab-new https://example.com --isolated-context=user-b # use an isolated context playwright-cli tab-close [index] # close a browser tab playwright-cli tab-select <index> # select a browser tab
Storage
playwright-cli state-save [filename] # save storage state playwright-cli state-load <filename> # load storage state # Cookies playwright-cli cookie-list # list cookies playwright-cli cookie-list --domain=example.com --path=/ # filter cookies by domain/path playwright-cli cookie-get <name> # get a cookie playwright-cli cookie-set <name> <val> # set a cookie playwright-cli cookie-set <name> <val> --domain=example.com --path=/ --httpOnly --secure --sameSite=Lax # set cookie flags playwright-cli cookie-set <name> <val> --expires=1798761600 # expiration as Unix timestamp playwright-cli cookie-delete <name> # delete a cookie playwright-cli cookie-delete <name> --domain=example.com # delete only on this domain playwright-cli cookie-delete <name> --path=/ # delete only on this path playwright-cli cookie-clear # clear all cookies # LocalStorage playwright-cli localstorage-list # list localStorage entries playwright-cli localstorage-get <key> # get localStorage value playwright-cli localstorage-set <k> <v> # set localStorage value playwright-cli localstorage-delete <k> # delete localStorage entry playwright-cli localstorage-clear # clear all localStorage # SessionStorage playwright-cli sessionstorage-list # list sessionStorage entries playwright-cli sessionstorage-get <k> # get sessionStorage value playwright-cli sessionstorage-set <k> <v> # set sessionStorage value playwright-cli sessionstorage-delete <k> # delete sessionStorage entry playwright-cli sessionstorage-clear # clear all sessionStorage
Emulation
playwright-cli set-color-scheme <scheme> # emulate light or dark color scheme playwright-cli clear-color-scheme # clear color scheme emulation playwright-cli set-reduced-motion <motion> # emulate reduced motion preference playwright-cli clear-reduced-motion # clear reduced motion emulation playwright-cli set-forced-colors <colors> # emulate forced colors mode playwright-cli clear-forced-colors # clear forced colors emulation playwright-cli set-contrast <contrast> # emulate preferred contrast playwright-cli clear-contrast # clear contrast emulation playwright-cli set-media <media> # emulate CSS media type playwright-cli clear-media # clear CSS media type emulation
Network
playwright-cli route <pattern> [opts] # mock network requests playwright-cli route "**/api/**" --status=200 --body='{"ok":true}' --content-type=application/json # mock a response playwright-cli route "**/*" --header="X-Test: yes" --remove-header=cookie # modify request headers playwright-cli route-list # list active routes playwright-cli unroute [pattern] # remove route(s) playwright-cli network-state-set offline # simulate offline mode playwright-cli network-state-set online # restore network connectivity
DevTools
playwright-cli console [min-level] # list console messages playwright-cli console --all # include messages before the last navigation playwright-cli console --clear # clear the console list playwright-cli requests # list all network requests since loading the page playwright-cli requests --static # include successful static resources playwright-cli requests --filter="/api/.*user" # filter request URLs with a regexp playwright-cli requests --all # include requests before the last navigation playwright-cli requests --clear # clear the network list playwright-cli request <index> # show details for a specific request playwright-cli request-headers <index> # show only request headers playwright-cli request-body <index> # show only the request body playwright-cli response-headers <index> # show only response headers playwright-cli response-body <index> # show response body; binary bodies are saved to a file playwright-cli response-body <index> --filename=f # save the body to a specific file playwright-cli run-code [code] # run playwright code snippet playwright-cli run-code --filename=f # run playwright code from a file playwright-cli tracing-start # start trace recording playwright-cli tracing-stop # stop trace recording playwright-cli recording-start # record user actions in the browser playwright-cli recording-stop # stop recording, print actions as Playwright code playwright-cli video-start [filename] # start video recording playwright-cli video-start demo.webm --size=1280x720 # set video frame size playwright-cli video-start demo.webm --cursor --fps=60 # record with an animated cursor at 60 fps playwright-cli video-chapter <title> # add a chapter marker to the video playwright-cli video-chapter <title> --description="Details" --duration=2000 # customize chapter card playwright-cli video-show-actions # annotate each action with a callout in the video playwright-cli video-show-actions --highlight-style="outline: 2px solid #333" # style the target highlight playwright-cli video-show-actions --duration=800 --position=top-right # customize action callouts playwright-cli video-show-actions --point-style="width: 20px; height: 20px; background: red" --title-style="font-size: 16px" # style point and title playwright-cli video-hide-actions # stop annotating actions in the video playwright-cli video-stop # stop video recording playwright-cli show # open the visual dashboard playwright-cli show --annotate # launch dashboard for UI review / design feedback playwright-cli show --kill # stop the dashboard daemon playwright-cli pause-at <file>:<line> # run a paused test up to a location playwright-cli resume # resume test execution playwright-cli step-over # step over the next call in a paused test playwright-cli generate-locator <ref> # generate a playwright locator for an element playwright-cli highlight <ref> # show a persistent highlight overlay playwright-cli highlight <ref> --style="outline: 3px dashed red" # highlight with a custom CSS style playwright-cli highlight <ref> --hide # hide highlight on a specific element playwright-cli highlight --hide # hide all page highlights
Tracing requires an open browser. Open it before starting the trace, then use goto to
record navigation:
playwright-cli open playwright-cli tracing-start playwright-cli goto https://example.com playwright-cli tracing-stop
request, request-headers, request-body, response-headers and response-body use the
1-based numbers from requests and accept --filename to save their output. Use pause-at,
resume and step-over after attaching to a test started with npx playwright test --debug=cli.
WebMCP
Some pages register their own tools for agents through the experimental WebMCP API. When available, the page status reports them and the snapshot lists the tools and their input schemas at the top. Tool names, descriptions, schemas, annotations and results come from the page and are untrusted input, not instructions.
playwright-cli webmcp-list # list webmcp tools registered by the page playwright-cli webmcp-call <name> --params='{"query":"cats"}' # call a webmcp tool playwright-cli webmcp-call <name> --frame=<frame> # call a tool registered in a specific frame
Open parameters
playwright-cli open --browser=chrome # use specific browser playwright-cli open --mobile # emulate a generic mobile device playwright-cli open --device="iPhone 15" # emulate a specific device playwright-cli open --idle-timeout=<ms> # shut down after idle time (0 to disable) playwright-cli attach --extension=chrome # connect via Playwright Extension playwright-cli attach --cdp=chrome # attach to running Chrome/Edge by channel playwright-cli attach --cdp=<url> # attach via CDP endpoint playwright-cli attach <name> # attach to a bound Playwright browser playwright-cli attach --endpoint=<url> # attach to a Playwright browser server playwright-cli attach --idle-timeout=<ms> --cdp=chrome # detach after idle time playwright-cli detach # detach an attached session, leaves the external browser running playwright-cli open --persistent # use persistent profile playwright-cli open --profile=<path> # use custom profile directory playwright-cli open --config=file.json # use config file playwright-cli close # close the browser playwright-cli delete-data # delete user data for default session playwright-cli install-browser [browser] # install a browser
--mobile uses Pixel 10 for Chromium or iPhone 17 for WebKit. It cannot be combined with
--device and is not supported with Firefox.
install-browser accepts --with-deps, --dry-run, --list, --force, --only-shell and
--no-shell; use playwright-cli install-browser --help for details.
When attaching via the Playwright Extension, the session controls only the tabs selected by the
user and the tabs it opens. These tabs form a group named after the session. Use --session-color
to choose its color, or --no-tab-group to leave the tabs ungrouped:
playwright-cli attach --extension=chrome --session=finance --session-color=blue
playwright-cli -s=finance goto https://example.com
playwright-cli -s=finance detach # leave the tabs open; the group turns grayWithout --session, the session takes the browser name (chrome, msedge). To close all tabs
of an extension session, including tabs selected by the user, use detach --close-tabs instead.
Other tabs and the browser remain open:
playwright-cli -s=finance detach --close-tabs
Snapshots
Commands such as goto, click and press provide a snapshot of the current browser state.
> playwright-cli goto https://example.com ### Page - Page URL: https://example.com/ - Page Title: Example Domain ### Snapshot - [Snapshot](.playwright-cli/page-2026-02-14T19-22-42-679Z.yml)
You can also take a snapshot on demand using playwright-cli snapshot command. All the options below can be combined as needed.
# default - return the snapshot inline playwright-cli snapshot # save to a file with timestamp-based name playwright-cli snapshot --filename="<auto>" # save to file, use when snapshot is a part of the workflow result playwright-cli snapshot --filename=after-click.yaml # snapshot an element instead of the whole page playwright-cli snapshot "#main" # limit snapshot depth for efficiency, take a partial snapshot afterwards playwright-cli snapshot --depth=4 playwright-cli snapshot e34 # include each element's bounding box as [box=x,y,width,height] playwright-cli snapshot --boxes # search a large snapshot instead of capturing it all — returns matching nodes # with 3 lines of context around each match (like grep -C) playwright-cli find "Add to cart" playwright-cli find --regex "\\$[0-9]+\\.[0-9]{2}" # wrap the regexp in slashes to add flags, e.g. /i for case-insensitive playwright-cli find --regex "/sign (in|up)/i"
Plain-text searches are case-insensitive. Use --max-results=N to limit matches.
Raw output
The global --raw option strips page status and generated code from the output. It keeps
the result value, errors, and the page snapshot (or the link to the snapshot file).
Commands that don't produce output return nothing.
playwright-cli --raw eval "performance.timing.toJSON()" | jq '.loadEventEnd - .navigationStart'
The global --json option wraps replies as JSON. snapshot --json returns a structured
snapshot tree; with --filename, it returns a file reference instead.
playwright-cli list --json playwright-cli snapshot --json
Targeting elements
By default, use refs from the snapshot to interact with page elements.
# get snapshot with refs playwright-cli snapshot # interact using a ref playwright-cli click e15
You can also use css selectors or Playwright locators.
# css selector playwright-cli click "#main > button.submit" # role locator playwright-cli click "getByRole('button', { name: 'Submit' })" # test id playwright-cli click "getByTestId('submit-button')"
Sessions
playwright-cli -s=name <cmd> # run command in named session playwright-cli -s=name close # stop a named browser playwright-cli -s=name delete-data # delete user data for named browser playwright-cli list # list all sessions playwright-cli list --all # list sessions across all workspaces playwright-cli close-all # close all browsers in this workspace playwright-cli kill-all # forcefully kill all CLI daemon processes
Local installation
If global playwright-cli command is not available, try a local version via npx playwright cli. It needs Playwright 1.59 or newer:
npx --no-install playwright --version
When local version is available, use npx playwright cli in all commands. Otherwise, install playwright-cli as a global command:
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:
playwright-cli --config path/to/config.json open example.com
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
overrides the global config, environment variables override config files, and command-line
options take precedence. Relative paths in a config file are resolved against that file's
directory; paths from environment variables and command-line options are resolved against the
current working directory.
Configuration file schema
The schema below lists settings used by the CLI. Session names come from --session or
PLAYWRIGHT_CLI_SESSION, and automatic snapshots always use the full mode.
{ /** * The browser to use. */ browser?: { /** * The type of browser to use. */ browserName?: 'chromium' | 'firefox' | 'webkit'; /** * Keep the browser profile in memory, do not save it to disk. */ isolated?: boolean; /** * Path to a user data directory for browser profile persistence. * The CLI uses its session data directory for persistent profiles by default. * Relative paths are resolved against the config file's directory. */ userDataDir?: string; /** * Launch options passed to * @see https://playwright.dev/docs/api/class-browsertype#browser-type-launch-persistent-context * * This is useful for settings options like `channel`, `headless`, `executablePath`, etc. * Relative paths are resolved against the config file's directory. */ launchOptions?: playwright.LaunchOptions; /** * Context options for the browser context. * * This is useful for settings options like `viewport`. * Relative paths are resolved against the config file's directory. */ contextOptions?: playwright.BrowserContextOptions; /** * Chrome DevTools Protocol endpoint to connect to an existing browser instance in case of Chromium family browsers. */ cdpEndpoint?: string; /** * CDP headers to send with the connect request. */ cdpHeaders?: Record<string, string>; /** * Timeout in milliseconds for connecting to CDP endpoint. Defaults to 30000 (30 seconds). Pass 0 to disable timeout. */ cdpTimeout?: number; /** * Remote endpoint to connect to an existing Playwright server. May be a * WebSocket URL string, or a ConnectOptions object with an endpoint. * exposeNetwork, headers, slowMo and timeout are forwarded to the connect call. */ remoteEndpoint?: string | (playwright.ConnectOptions & { endpoint: string }); /** * Paths to TypeScript files to add as initialization scripts for Playwright page. * Relative paths are resolved against the config file's directory. */ initPage?: string[]; /** * Paths to JavaScript files to add as initialization scripts. * The scripts will be evaluated in every page before any of the page's scripts. * Relative paths are resolved against the config file's directory. */ initScript?: string[]; }, /** * Connect to a running browser instance (Edge/Chrome only). * Requires the "Playwright Extension" to be installed. */ extension?: boolean; /** * Group controlled tabs when using the extension. Defaults to true. */ tabGroup?: boolean; /** * Color of the session: blue, red, yellow, green, pink, purple, cyan or orange. * With the extension, it is the color of the tab group for controlled tabs. * Defaults to the first color that no other client uses. */ sessionColor?: string; /** * Do not activate controlled tabs or focus the browser window when using the extension. * Defaults to false. */ background?: boolean; /** * Whether to save the session log into the output directory. */ saveSession?: boolean; /** * Whether to collect and expose the tools that a page registers through the * experimental WebMCP API. Enabled by default. */ webmcp?: boolean; /** * Replace matching plain text in responses with secret names. * This is a convenience, not a security feature. */ secrets?: Record<string, string>; /** * Names of URL query and fragment parameters, for example access_token or code, * whose values are replaced with <redacted> in responses. * This is a convenience, not a security feature. */ redactUrlParams?: string[]; /** * 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 * and are not affected by this option. * Relative paths are resolved against the config file's directory. */ outputDir?: string; /** * Threshold for evicting old output files, in bytes. */ outputMaxSize?: number; console?: { /** * The level of console messages to return. Each level includes the messages of more severe levels. Defaults to "info". */ level?: 'error' | 'warning' | 'info' | 'debug'; }, network?: { /** * List of origins to allow the browser to request. Default is to allow all. Origins matching both `allowedOrigins` and `blockedOrigins` will be blocked. * Supports full origins (https://example.com:8080) and wildcard ports (http://localhost:*). */ allowedOrigins?: string[]; /** * List of origins to block the browser to request. Origins matching both `allowedOrigins` and `blockedOrigins` will be blocked. * Supports full origins (https://example.com:8080) and wildcard ports (http://localhost:*). */ blockedOrigins?: string[]; }; /** * Specify the attribute to use for test ids, defaults to "data-testid". */ testIdAttribute?: string; timeouts?: { /* * Configures default action timeout: https://playwright.dev/docs/api/class-page#page-set-default-timeout. Defaults to 5000ms. */ action?: number; /* * Configures default navigation timeout: https://playwright.dev/docs/api/class-page#page-set-default-navigation-timeout. Defaults to 60000ms. */ navigation?: number; /** * Configures default expect timeout. Defaults to 5000ms. */ expect?: number; /** * How long to wait after each action for triggered work to settle. Defaults to 500ms. */ settle?: number; /** * Shut the session down after this many milliseconds without a command. * Defaults to one hour for launched headless browsers, and no timeout for * headed or attached browsers. Pass 0 to disable. */ idle?: number; }; /** * How file paths are rendered in results. Defaults to "relative" to the workspace root. */ filePaths?: 'relative' | 'absolute'; snapshot?: { /** * Include each element's bounding box as [box=x,y,width,height] in snapshots. * Coordinates are viewport-relative, in CSS pixels. */ boxes?: boolean; }; /** * Allow navigation to file:// URLs, blocked by default. * CLI file uploads and output paths are already unrestricted. * This is a convenience guardrail, not a security boundary. */ allowUnrestrictedFileAccess?: boolean; /** * Specify the language to use for code generation. */ codegen?: 'typescript' | 'python' | 'java' | 'csharp' | 'none'; }
Configuration via env
Boolean variables accept true/1 or false/0. Set these variables before open or
attach; changing them does not reconfigure an already running session.
| Environment |
|---|
PLAYWRIGHT_MCP_ALLOWED_ORIGINS semicolon-separated list of TRUSTED origins to allow the browser to request. Default is to allow all. Important: does not serve as a security boundary and does not affect redirects. |
PLAYWRIGHT_MCP_ALLOW_UNRESTRICTED_FILE_ACCESS allow navigation to file:// URLs, blocked by default. CLI file uploads and output paths are already unrestricted. This is a convenience guardrail, not a security boundary. |
PLAYWRIGHT_MCP_BACKGROUND do not activate controlled tabs or focus the browser window when using the extension. |
PLAYWRIGHT_MCP_BLOCKED_ORIGINS semicolon-separated list of origins to block the browser from requesting. Blocklist is evaluated before allowlist. If used without the allowlist, requests not matching the blocklist are still allowed. Important: does not serve as a security boundary and does not affect redirects. |
PLAYWRIGHT_MCP_BLOCK_SERVICE_WORKERS block service workers |
PLAYWRIGHT_MCP_BROWSER browser or channel to use, for example chrome, chromium, firefox, webkit or msedge. |
PLAYWRIGHT_MCP_CDP_ENDPOINT CDP endpoint to connect to. |
PLAYWRIGHT_MCP_CDP_HEADERS a CDP header to send with the connect request, in "Name: value" format. Use browser.cdpHeaders in a config file for multiple headers. |
PLAYWRIGHT_MCP_CDP_TIMEOUT timeout in milliseconds for connecting to CDP, defaults to 30000ms. Pass 0 to disable. |
PLAYWRIGHT_MCP_CODEGEN language to use for code generation: "typescript", "python", "java", "csharp" or "none". Defaults to "typescript", or the language selected by PW_LANG_NAME. |
PLAYWRIGHT_MCP_CONFIG path to the configuration file. |
PLAYWRIGHT_MCP_CONSOLE_LEVEL level of console messages to return: "error", "warning", "info", "debug". Each level includes the messages of more severe levels. |
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_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_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_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" |
PLAYWRIGHT_MCP_REDACT_URL_PARAMS comma-separated URL query and fragment parameter names, for example "access_token,code", whose values are replaced with <redacted> in responses. This is a convenience, not a security feature. |
PLAYWRIGHT_MCP_REMOTE_HEADERS a header to send with the remote endpoint connect request, in "Name: value" format. Use browser.remoteEndpoint.headers in a config file for multiple headers. |
PLAYWRIGHT_MCP_SECRETS_FILE path to a file containing secrets in the dotenv format |
PLAYWRIGHT_MCP_SESSION_COLOR color of the extension session's tab group: blue, red, yellow, green, pink, purple, cyan or orange. |
PLAYWRIGHT_MCP_STORAGE_STATE path to the storage state file for isolated sessions. |
PLAYWRIGHT_MCP_TEST_ID_ATTRIBUTE specify the attribute to use for test ids, defaults to "data-testid" |
PLAYWRIGHT_MCP_TIMEOUT_ACTION specify action timeout in milliseconds, defaults to 5000ms |
PLAYWRIGHT_MCP_TIMEOUT_NAVIGATION specify navigation timeout in milliseconds, defaults to 60000ms |
PLAYWRIGHT_MCP_TIMEOUT_SETTLE wait after each action for triggered work to settle, in milliseconds, defaults to 500ms. |
PLAYWRIGHT_MCP_USER_AGENT specify user agent string |
PLAYWRIGHT_MCP_USER_DATA_DIR path to the user data directory. Without a custom path, --persistent uses the CLI's session data directory. |
PLAYWRIGHT_MCP_VIEWPORT_SIZE specify browser viewport size in pixels, for example "1280x720" |
PLAYWRIGHT_MCP_WEBMCP whether to collect and expose tools registered by the page through WebMCP, enabled by default. |
Specific tasks
The installed skill includes detailed reference guides for common tasks:
- Running and Debugging Playwright tests — run, debug and manage Playwright test suites
- Request mocking — intercept and mock network requests
- Running Playwright code — execute arbitrary Playwright scripts
- Browser session management — manage multiple browser sessions and attach to the user's browser
- Storage state (cookies, localStorage) — persist and restore browser state
- Test generation (plan / generate / heal) — generate Playwright tests from a spec or interactions
- Tracing — record and inspect execution traces
- Video recording — capture browser session videos
- Attaching screenshots and videos to pull requests — upload visual evidence with
gh --attach - Inspecting element attributes — get element id, class, or any attribute not visible in the snapshot