Skip to content
Back to search

playwright-cli

CLI for common Playwright actions. Record and generate Playwright code, inspect selectors and take screenshots.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 11 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/microsoft/playwright-cli with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/microsoft/playwright-cli'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/microsoft--playwright-cli/badge.svg)](/listings/microsoft--playwright-cli)

HTML

<a href="/listings/microsoft--playwright-cli"><img src="/api/listings/microsoft--playwright-cli/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

npm install -g @playwright/cli@latest
playwright-cli --help

Installing skills

Claude Code, GitHub Copilot and others will use the locally installed skills.

playwright-cli install --skills

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.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 661 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. # playwright-cli
  2. Playwright CLI with SKILLS
  3. ### Playwright CLI vs Playwright MCP
  4. This package provides CLI interface into Playwright. If you are using **coding agents**, that is the best fit.
  5. - **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.
  6. - **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](https://github.com/microsoft/playwright-mcp).
  7. ### Key Features
  8. - **Token-efficient**. Does not force page data into LLM.
  9. ### Requirements
  10. - Node.js 20 or newer
  11. - Claude Code, GitHub Copilot, or any other coding agent.
  12. ## Getting Started
  13. ## Installation
  14. ```bash
  15. npm install -g @playwright/cli@latest
  16. playwright-cli --help
  17. ```
  18. Argument parsing and startup errors exit with code 1 and print an error message. With
  19. `--json`, these errors are written to stdout as `{ "isError": true, "error": "..." }`.
  20. ### Installing skills
  21. Claude Code, GitHub Copilot and others will use the locally installed skills.
  22. ```bash
  23. playwright-cli install --skills
  24. ```
  25. ### Skills-less operation
  26. Point your agent at the CLI and let it cook. It'll read the skill off `playwright-cli --help` on its own:
  27. ```
  28. Test the "add todo" flow on https://demo.playwright.dev/todomvc using playwright-cli.
  29. Check playwright-cli --help for available commands.
  30. ```
  31. ## Demo
  32. ```
  33. > Use playwright skills to test https://demo.playwright.dev/todomvc/.
  34. Take screenshots for all successful and failing scenarios.
  35. ```
  36. Your agent will be running commands, but it does not mean you can't play with it manually:
  37. ```
  38. playwright-cli open https://demo.playwright.dev/todomvc/ --headed
  39. playwright-cli type "Buy groceries"
  40. playwright-cli press Enter
  41. playwright-cli type "Water flowers"
  42. playwright-cli press Enter
  43. playwright-cli check e21
  44. playwright-cli check e35
  45. playwright-cli screenshot
  46. ```
  47. ## Headed operation
  48. Playwright CLI is headless by default. If you'd like to see the browser, pass `--headed` to `open`:
  49. ```bash
  50. playwright-cli open https://playwright.dev --headed
  51. ```
  52. ## Sessions
  53. Playwright CLI keeps the browser profile in memory by default. Your cookies and storage state
  54. are preserved between CLI calls within the session, but lost when the browser closes. Use
  55. `--persistent` to save the profile to disk for persistence across browser restarts.
  56. You can use different instances of the browser for different projects with sessions. Pass `-s=name`,
  57. `-s name` or `--session name` to the invocation to talk to a specific browser.
  58. ```bash
  59. playwright-cli open https://playwright.dev
  60. playwright-cli -s=example open https://example.com --persistent
  61. playwright-cli list
  62. ```
  63. You can run your coding agent with the `PLAYWRIGHT_CLI_SESSION` environment variable:
  64. ```bash
  65. PLAYWRIGHT_CLI_SESSION=todo-app claude .
  66. ```
  67. Or instruct it to prepend `-s=` to the calls.
  68. A headless session shuts down on its own after an hour without commands; run `open` again to
  69. start a new one. Headed browsers stay open. Use `open --idle-timeout=<ms>` to change the timeout,
  70. or `0` to disable it.
  71. Manage your sessions as follows:
  72. ```bash
  73. playwright-cli list # list all sessions
  74. playwright-cli close-all # close all browsers
  75. playwright-cli kill-all # forcefully kill all browser processes
  76. ```
  77. ## Monitoring
  78. Use `playwright-cli show` to open a visual dashboard that lets you see and control all running
  79. browser sessions. This is useful when your coding agents are running browser automation in the
  80. background and you want to observe their progress or step in to help.
  81. ```bash
  82. playwright-cli show
  83. ```
  84. <img width="1107" height="729" alt="Image" src="https://github.com/user-attachments/assets/99df739d-106a-4520-b004-bb315db41da7" />
  85. The dashboard opens a window with two views:
  86. - **Session grid** — shows all active sessions grouped by workspace, each with a live screencast
  87. preview, session name, current URL, and page title. Click any session to zoom in.
  88. - **Session detail** — shows a live view of the selected session with a tab bar, navigation
  89. controls (back, forward, reload, address bar), and full remote control. Click into the viewport
  90. to take over mouse and keyboard input; press Escape to release.
  91. From the grid you can also close running sessions or delete data for inactive ones.
  92. ## Commands
  93. ### Core
  94. ```bash
  95. playwright-cli open [url] # open browser, optionally navigate to url
  96. playwright-cli goto <url> # navigate to a url
  97. playwright-cli close # close the page
  98. playwright-cli type <text> # type text into editable element
  99. playwright-cli click <ref> [button] # perform click on a web page
  100. playwright-cli dblclick <ref> [button] # perform double click on a web page
  101. playwright-cli fill <ref> <text> # fill text into editable element
  102. playwright-cli fill <ref> <text> --submit # fill and press Enter
  103. playwright-cli drag <startRef> <endRef> # perform drag and drop between two elements
  104. playwright-cli drop <ref> --path=<file> # drop files onto an element (from outside the page)
  105. playwright-cli drop <ref> --data="k=v" # drop data onto an element
  106. playwright-cli hover <ref> # hover over element on page
  107. playwright-cli select <ref> <val> # select an option in a dropdown
  108. playwright-cli upload <file> # upload one or multiple files
  109. playwright-cli check <ref> # check a checkbox or radio button
  110. playwright-cli uncheck <ref> # uncheck a checkbox or radio button
  111. playwright-cli snapshot # capture page snapshot to obtain element ref
  112. playwright-cli snapshot --filename=f # save snapshot to specific file
  113. playwright-cli snapshot <ref> # snapshot a specific element
  114. playwright-cli snapshot --depth=N # limit snapshot depth for efficiency
  115. playwright-cli find <text> # search the snapshot for text, returns matching nodes
  116. playwright-cli find --regex <pattern> # search the snapshot with a regexp
  117. playwright-cli find <text> --filename=f # save matches to a file
  118. playwright-cli eval <func> [ref] # evaluate javascript expression on page or element
  119. playwright-cli dialog-accept [prompt] # accept a dialog
  120. playwright-cli dialog-dismiss # dismiss a dialog
  121. playwright-cli resize <w> <h> # resize the browser window
  122. ```
  123. ### Navigation
  124. ```bash
  125. playwright-cli go-back # go back to the previous page
  126. playwright-cli go-forward # go forward to the next page
  127. playwright-cli reload # reload the current page
  128. ```
  129. ### Keyboard
  130. ```bash
  131. playwright-cli press <key> # press a key on the keyboard, `a`, `arrowleft`
  132. playwright-cli keydown <key> # press a key down on the keyboard
  133. playwright-cli keyup <key> # press a key up on the keyboard
  134. ```
  135. ### Mouse
  136. ```bash
  137. playwright-cli mousemove <x> <y> # move mouse to a given position
  138. playwright-cli mousedown [button] # press mouse down
  139. playwright-cli mouseup [button] # press mouse up
  140. playwright-cli mousewheel <dx> <dy> # scroll by pixels; negative dy scrolls up
  141. ```
  142. The element under the mouse pointer scrolls, so use `mousemove` to move over it first.
  143. ### Save as
  144. ```bash
  145. playwright-cli screenshot [ref] # screenshot of the current page or element
  146. playwright-cli screenshot --filename=f # save screenshot with specific filename
  147. playwright-cli screenshot --hires # capture at full device pixel ratio
  148. playwright-cli pdf # save page as pdf
  149. playwright-cli pdf --filename=page.pdf # save pdf with specific filename
  150. ```
  151. ### Tabs
  152. ```bash
  153. playwright-cli tab-list # list all tabs
  154. playwright-cli tab-new [url] # create a new tab
  155. playwright-cli tab-new https://example.com --isolated-context=user-b # use an isolated context
  156. playwright-cli tab-close [index] # close a browser tab
  157. playwright-cli tab-select <index> # select a browser tab
  158. ```
  159. ### Storage
  160. ```bash
  161. playwright-cli state-save [filename] # save storage state
  162. playwright-cli state-load <filename> # load storage state
  163. # Cookies
  164. playwright-cli cookie-list [--domain] # list cookies
  165. playwright-cli cookie-get <name> # get a cookie
  166. playwright-cli cookie-set <name> <val> # set a cookie
  167. playwright-cli cookie-delete <name> # delete a cookie
  168. playwright-cli cookie-delete <name> --domain=example.com # delete only on this domain
  169. playwright-cli cookie-clear # clear all cookies
  170. # LocalStorage
  171. playwright-cli localstorage-list # list localStorage entries
  172. playwright-cli localstorage-get <key> # get localStorage value
  173. playwright-cli localstorage-set <k> <v> # set localStorage value
  174. playwright-cli localstorage-delete <k> # delete localStorage entry
  175. playwright-cli localstorage-clear # clear all localStorage
  176. # SessionStorage
  177. playwright-cli sessionstorage-list # list sessionStorage entries
  178. playwright-cli sessionstorage-get <k> # get sessionStorage value
  179. playwright-cli sessionstorage-set <k> <v> # set sessionStorage value
  180. playwright-cli sessionstorage-delete <k> # delete sessionStorage entry
  181. playwright-cli sessionstorage-clear # clear all sessionStorage
  182. ```
  183. ### Emulation
  184. ```bash
  185. playwright-cli set-color-scheme <scheme> # emulate light or dark color scheme
  186. playwright-cli clear-color-scheme # clear color scheme emulation
  187. playwright-cli set-reduced-motion <motion> # emulate reduced motion preference
  188. playwright-cli clear-reduced-motion # clear reduced motion emulation
  189. playwright-cli set-forced-colors <colors> # emulate forced colors mode
  190. playwright-cli clear-forced-colors # clear forced colors emulation
  191. playwright-cli set-contrast <contrast> # emulate preferred contrast
  192. playwright-cli clear-contrast # clear contrast emulation
  193. playwright-cli set-media <media> # emulate CSS media type
  194. playwright-cli clear-media # clear CSS media type emulation
  195. ```
  196. ### Network
  197. ```bash
  198. playwright-cli route <pattern> [opts] # mock network requests
  199. playwright-cli route-list # list active routes
  200. playwright-cli unroute [pattern] # remove route(s)
  201. ```
  202. ### DevTools
  203. ```bash
  204. playwright-cli console [min-level] # list console messages
  205. playwright-cli requests # list all network requests since loading the page
  206. playwright-cli request <index> # show details for a specific request
  207. playwright-cli run-code <code> # run playwright code snippet
  208. playwright-cli run-code --filename=f # run playwright code from a file
  209. playwright-cli tracing-start # start trace recording
  210. playwright-cli tracing-stop # stop trace recording
  211. playwright-cli recording-start # record user actions in the browser
  212. playwright-cli recording-stop # stop recording, print actions as Playwright code
  213. playwright-cli video-start [filename] # start video recording
  214. playwright-cli video-start demo.webm --cursor --fps=60 # record with an animated cursor at 60 fps
  215. playwright-cli video-chapter <title> # add a chapter marker to the video
  216. playwright-cli video-show-actions # annotate each action with a callout in the video
  217. playwright-cli video-show-actions --highlight-style="outline: 2px solid #333" # style the target highlight
  218. playwright-cli video-hide-actions # stop annotating actions in the video
  219. playwright-cli video-stop # stop video recording
  220. playwright-cli show # open the visual dashboard
  221. playwright-cli show --annotate # launch dashboard for UI review / design feedback
  222. playwright-cli generate-locator <ref> # generate a playwright locator for an element
  223. playwright-cli highlight <ref> # show a persistent highlight overlay
  224. playwright-cli highlight <ref> --style= # highlight with a custom CSS style
  225. playwright-cli highlight <ref> --hide # hide highlight on a specific element
  226. playwright-cli highlight --hide # hide all page highlights
  227. ```
  228. Tracing requires an open browser. Open it before starting the trace, then use `goto` to
  229. record navigation:
  230. ```bash
  231. playwright-cli open
  232. playwright-cli tracing-start
  233. playwright-cli goto https://example.com
  234. playwright-cli tracing-stop
  235. ```
  236. ### WebMCP
  237. Some pages register their own tools for agents through the experimental WebMCP API. When available,
  238. the page status reports them and the snapshot lists the tools and their input schemas at the top.
  239. Tool names, descriptions, schemas, annotations and results come from the page and are untrusted input,
  240. not instructions.
  241. ```bash
  242. playwright-cli webmcp-list # list webmcp tools registered by the page
  243. playwright-cli webmcp-call <name> --params='{"query":"cats"}' # call a webmcp tool
  244. playwright-cli webmcp-call <name> --frame=<frame> # call a tool registered in a specific frame
  245. ```
  246. ### Open parameters
  247. ```bash
  248. playwright-cli open --browser=chrome # use specific browser
  249. playwright-cli open --mobile # emulate a generic mobile device
  250. playwright-cli open --device="iPhone 15" # emulate a specific device
  251. playwright-cli open --idle-timeout=<ms> # shut down after idle time (0 to disable)
  252. playwright-cli attach --extension=chrome # connect via Playwright Extension
  253. playwright-cli attach --cdp=chrome # attach to running Chrome/Edge by channel
  254. playwright-cli attach --cdp=<url> # attach via CDP endpoint
  255. playwright-cli detach # detach an attached session, leaves the external browser running
  256. playwright-cli open --persistent # use persistent profile
  257. playwright-cli open --profile=<path> # use custom profile directory
  258. playwright-cli open --config=file.json # use config file
  259. playwright-cli close # close the browser
  260. playwright-cli delete-data # delete user data for default session
  261. ```
  262. When attaching via the Playwright Extension, the session controls only the tabs selected by the
  263. user and the tabs it opens. These tabs form a group named after the session. Use `--session-color`
  264. to choose its color, or `--no-tab-group` to leave the tabs ungrouped:
  265. ```bash
  266. playwright-cli attach --extension=chrome --session=finance --session-color=blue
  267. playwright-cli -s=finance goto https://example.com
  268. playwright-cli -s=finance detach # leave the tabs open; the group turns gray
  269. ```
  270. Without `--session`, the session takes the browser name (`chrome`, `msedge`). To close all tabs
  271. of an extension session, including tabs selected by the user, use `detach --close-tabs` instead.
  272. Other tabs and the browser remain open:
  273. ```bash
  274. playwright-cli -s=finance detach --close-tabs
  275. ```
  276. ### Snapshots
  277. After each command, playwright-cli provides a snapshot of the current browser state.
  278. ```bash
  279. > playwright-cli goto https://example.com
  280. ### Page
  281. - Page URL: https://example.com/
  282. - Page Title: Example Domain
  283. ### Snapshot
  284. [Snapshot](.playwright-cli/page-2026-02-14T19-22-42-679Z.yml)
  285. ```
  286. You can also take a snapshot on demand using `playwright-cli snapshot` command. All the options below can be combined as needed.
  287. ```bash
  288. # default - save to a file with timestamp-based name
  289. playwright-cli snapshot
  290. # save to file, use when snapshot is a part of the workflow result
  291. playwright-cli snapshot --filename=after-click.yaml
  292. # snapshot an element instead of the whole page
  293. playwright-cli snapshot "#main"
  294. # limit snapshot depth for efficiency, take a partial snapshot afterwards
  295. playwright-cli snapshot --depth=4
  296. playwright-cli snapshot e34
  297. # include each element's bounding box as [box=x,y,width,height]
  298. playwright-cli snapshot --boxes
  299. # search a large snapshot instead of capturing it all — returns matching nodes
  300. # with 3 lines of context around each match (like grep -C)
  301. playwright-cli find "Add to cart"
  302. playwright-cli find --regex "\\$[0-9]+\\.[0-9]{2}"
  303. # wrap the regexp in slashes to add flags, e.g. /i for case-insensitive
  304. playwright-cli find --regex "/sign (in|up)/i"
  305. ```
  306. ### Raw output
  307. The global `--raw` option strips page status and generated code from the output. It keeps
  308. the result value, errors, and the page snapshot (or the link to the snapshot file).
  309. Commands that don't produce output return nothing.
  310. ```bash
  311. playwright-cli --raw eval "JSON.stringify(performance.timing)" | jq '.loadEventEnd - .navigationStart'
  312. ```
  313. ### Targeting elements
  314. By default, use refs from the snapshot to interact with page elements.
  315. ```bash
  316. # get snapshot with refs
  317. playwright-cli snapshot
  318. # interact using a ref
  319. playwright-cli click e15
  320. ```
  321. You can also use css selectors or Playwright locators.
  322. ```bash
  323. # css selector
  324. playwright-cli click "#main > button.submit"
  325. # role locator
  326. playwright-cli click "getByRole('button', { name: 'Submit' })"
  327. # test id
  328. playwright-cli click "getByTestId('submit-button')"
  329. ```
  330. ### Sessions
  331. ```bash
  332. playwright-cli -s=name <cmd> # run command in named session
  333. playwright-cli -s=name close # stop a named browser
  334. playwright-cli -s=name delete-data # delete user data for named browser
  335. playwright-cli list # list all sessions
  336. playwright-cli close-all # close all browsers
  337. playwright-cli kill-all # forcefully kill all browser processes
  338. ```
  339. ### Local installation
  340. If global `playwright-cli` command is not available, try a local version via `npx playwright cli`. It needs Playwright 1.59 or newer:
  341. ```bash
  342. npx --no-install playwright --version
  343. ```
  344. When local version is available, use `npx playwright cli` in all commands. Otherwise, install `playwright-cli` as a global command:
  345. ```bash
  346. npm install -g @playwright/cli@latest
  347. ```
  348. ## Configuration file
  349. The Playwright CLI can be configured using a JSON configuration file. You can specify the configuration file using the `--config` command line option:
  350. ```bash
  351. playwright-cli --config path/to/config.json open example.com
  352. ```
  353. Playwright CLI will load config from `.playwright/cli.config.json` by default so that you did not need to specify it every time.
  354. <details>
  355. <summary>Configuration file schema</summary>
  356. ```typescript
  357. {
  358. /**
  359. * The browser to use.
  360. */
  361. browser?: {
  362. /**
  363. * The type of browser to use.
  364. */
  365. browserName?: 'chromium' | 'firefox' | 'webkit';
  366. /**
  367. * Keep the browser profile in memory, do not save it to disk.
  368. */
  369. isolated?: boolean;
  370. /**
  371. * Path to a user data directory for browser profile persistence.
  372. * Temporary directory is created by default.
  373. */
  374. userDataDir?: string;
  375. /**
  376. * Launch options passed to
  377. * @see https://playwright.dev/docs/api/class-browsertype#browser-type-launch-persistent-context
  378. *
  379. * This is useful for settings options like `channel`, `headless`, `executablePath`, etc.
  380. */
  381. launchOptions?: playwright.LaunchOptions;
  382. /**
  383. * Context options for the browser context.
  384. *
  385. * This is useful for settings options like `viewport`.
  386. */
  387. contextOptions?: playwright.BrowserContextOptions;
  388. /**
  389. * Chrome DevTools Protocol endpoint to connect to an existing browser instance in case of Chromium family browsers.
  390. */
  391. cdpEndpoint?: string;
  392. /**
  393. * CDP headers to send with the connect request.
  394. */
  395. cdpHeaders?: Record<string, string>;
  396. /**
  397. * Timeout in milliseconds for connecting to CDP endpoint. Defaults to 30000 (30 seconds). Pass 0 to disable timeout.
  398. */
  399. cdpTimeout?: number;
  400. /**
  401. * Remote endpoint to connect to an existing Playwright server.
  402. */
  403. remoteEndpoint?: string;
  404. /**
  405. * Paths to TypeScript files to add as initialization scripts for Playwright page.
  406. */
  407. initPage?: string[];
  408. /**
  409. * Paths to JavaScript files to add as initialization scripts.
  410. * The scripts will be evaluated in every page before any of the page's scripts.
  411. */
  412. initScript?: string[];
  413. },
  414. /**
  415. * If specified, saves the Playwright video of the session into the output directory.
  416. */
  417. saveVideo?: {
  418. width: number;
  419. height: number;
  420. };
  421. /**
  422. * The directory to save output files.
  423. */
  424. outputDir?: string;
  425. /**
  426. * Whether to save snapshots, console messages, network logs and other session logs to a file or to the standard output. Defaults to "stdout".
  427. */
  428. outputMode?: 'file' | 'stdout';
  429. console?: {
  430. /**
  431. * The level of console messages to return. Each level includes the messages of more severe levels. Defaults to "info".
  432. */
  433. level?: 'error' | 'warning' | 'info' | 'debug';
  434. },
  435. network?: {
  436. /**
  437. * List of origins to allow the browser to request. Default is to allow all. Origins matching both `allowedOrigins` and `blockedOrigins` will be blocked.
  438. */
  439. allowedOrigins?: string[];
  440. /**
  441. * List of origins to block the browser to request. Origins matching both `allowedOrigins` and `blockedOrigins` will be blocked.
  442. */
  443. blockedOrigins?: string[];
  444. };
  445. /**
  446. * Specify the attribute to use for test ids, defaults to "data-testid".
  447. */
  448. testIdAttribute?: string;
  449. timeouts?: {
  450. /*
  451. * Configures default action timeout: https://playwright.dev/docs/api/class-page#page-set-default-timeout. Defaults to 5000ms.
  452. */
  453. action?: number;
  454. /*
  455. * Configures default navigation timeout: https://playwright.dev/docs/api/class-page#page-set-default-navigation-timeout. Defaults to 60000ms.
  456. */
  457. navigation?: number;
  458. };
  459. /**
  460. * Whether to allow file uploads from anywhere on the file system.
  461. * By default (false), file uploads are restricted to paths within the MCP roots only.
  462. */
  463. allowUnrestrictedFileAccess?: boolean;
  464. /**
  465. * Specify the language to use for code generation.
  466. */
  467. codegen?: 'typescript' | 'none';
  468. }
  469. ```
  470. </details>
  471. <details>
  472. <summary>Configuration via env</summary>
  473. | Environment |
  474. |-------------|
  475. | `PLAYWRIGHT_MCP_ALLOWED_HOSTS` comma-separated list of hosts this server is allowed to serve from. Defaults to the host the server is bound to. Pass '*' to disable the host check. |
  476. | `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. |
  477. | `PLAYWRIGHT_MCP_ALLOW_UNRESTRICTED_FILE_ACCESS` allow access to files outside of the workspace roots. Also allows unrestricted access to file:// URLs. By default access to file system is restricted to workspace root directories (or cwd if no roots are configured) only, and navigation to file:// URLs is blocked. |
  478. | `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. |
  479. | `PLAYWRIGHT_MCP_BLOCK_SERVICE_WORKERS` block service workers |
  480. | `PLAYWRIGHT_MCP_BROWSER` browser or chrome channel to use, possible values: chrome, firefox, webkit, msedge. |
  481. | `PLAYWRIGHT_MCP_CAPS` comma-separated list of additional capabilities to enable, possible values: vision, pdf. |
  482. | `PLAYWRIGHT_MCP_CDP_ENDPOINT` CDP endpoint to connect to. |
  483. | `PLAYWRIGHT_MCP_CDP_HEADERS` CDP headers to send with the connect request, multiple can be specified. |
  484. | `PLAYWRIGHT_MCP_CDP_TIMEOUT` timeout for the CDP connection. |
  485. | `PLAYWRIGHT_MCP_CONFIG` path to the configuration file. |
  486. | `PLAYWRIGHT_MCP_CONSOLE_LEVEL` level of console messages to return: "error", "warning", "info", "debug". Each level includes the messages of more severe levels. |
  487. | `PLAYWRIGHT_MCP_DEVICE` device to emulate, for example: "iPhone 15" |
  488. | `PLAYWRIGHT_MCP_EXECUTABLE_PATH` path to the browser executable. |
  489. | `PLAYWRIGHT_MCP_EXTENSION` Connect to a running browser instance (Edge/Chrome only). Requires the "Playwright MCP Bridge" browser extension to be installed. |
  490. | `PLAYWRIGHT_MCP_GRANT_PERMISSIONS` List of permissions to grant to the browser context, for example "geolocation", "clipboard-read", "clipboard-write". |
  491. | `PLAYWRIGHT_MCP_HEADLESS` whether to run browser in headless mode, headless by default. |
  492. | `PLAYWRIGHT_MCP_IGNORE_HTTPS_ERRORS` ignore https errors |
  493. | `PLAYWRIGHT_MCP_INIT_PAGE` path to TypeScript file to evaluate on Playwright page object |
  494. | `PLAYWRIGHT_MCP_INIT_SCRIPT` path to JavaScript file to add as an initialization script. The script will be evaluated in every page before any of the page's scripts. Can be specified multiple times. |
  495. | `PLAYWRIGHT_MCP_ISOLATED` keep the browser profile in memory, do not save it to disk. |
  496. | `PLAYWRIGHT_MCP_SANDBOX` whether to enable the browser sandbox. |
  497. | `PLAYWRIGHT_MCP_OUTPUT_DIR` path to the directory for output files. |
  498. | `PLAYWRIGHT_MCP_PROXY_BYPASS` comma-separated domains to bypass proxy, for example ".com,chromium.org,.domain.com" |
  499. | `PLAYWRIGHT_MCP_PROXY_SERVER` specify proxy server, for example "http://myproxy:3128" or "socks5://myproxy:8080" |
  500. | `PLAYWRIGHT_MCP_SAVE_TRACE` Whether to save the Playwright Trace of the session into the output directory. |
  501. | `PLAYWRIGHT_MCP_SAVE_VIDEO` Whether to save the video of the session into the output directory. For example "--save-video=800x600" |
  502. | `PLAYWRIGHT_MCP_SECRETS_FILE` path to a file containing secrets in the dotenv format |
  503. | `PLAYWRIGHT_MCP_STORAGE_STATE` path to the storage state file for isolated sessions. |
  504. | `PLAYWRIGHT_MCP_TEST_ID_ATTRIBUTE` specify the attribute to use for test ids, defaults to "data-testid" |
  505. | `PLAYWRIGHT_MCP_TIMEOUT_ACTION` specify action timeout in milliseconds, defaults to 5000ms |
  506. | `PLAYWRIGHT_MCP_TIMEOUT_NAVIGATION` specify navigation timeout in milliseconds, defaults to 60000ms |
  507. | `PLAYWRIGHT_MCP_USER_AGENT` specify user agent string |
  508. | `PLAYWRIGHT_MCP_USER_DATA_DIR` path to the user data directory. If not specified, a temporary directory will be created. |
  509. | `PLAYWRIGHT_MCP_VIEWPORT_SIZE` specify browser viewport size in pixels, for example "1280x720" |
  510. </details>
  511. ## Specific tasks
  512. The installed skill includes detailed reference guides for common tasks:
  513. * **Running and Debugging Playwright tests** — run, debug and manage Playwright test suites
  514. * **Request mocking** — intercept and mock network requests
  515. * **Running Playwright code** — execute arbitrary Playwright scripts
  516. * **Browser session management** — manage multiple browser sessions and attach to the user's browser
  517. * **Storage state (cookies, localStorage)** — persist and restore browser state
  518. * **Test generation (plan / generate / heal)** — generate Playwright tests from a spec or interactions
  519. * **Tracing** — record and inspect execution traces
  520. * **Video recording** — capture browser session videos
  521. * **Attaching screenshots and videos to pull requests** — upload visual evidence with `gh --attach`
  522. * **Inspecting element attributes** — get element id, class, or any attribute not visible in the snapshot

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.