SkillsReviewed · microsoft

Playwright CLI skill for browser automation and test authoring

This is an instruction skill from Microsoft that teaches an AI coding assistant to drive a real browser through the separate playwright-cli command-line tool. It is meant for developers who want an agent to explore, test and debug web pages. The main catch is that the skill does not include the tool, so playwright-cli has to be installed separately. Its front matter declares three allowed-tools patterns for playwright-cli and npx playwright commands, and those commands include ones that run JavaScript and handle cookies. The evidence does not show what permissions those patterns actually give, because that depends on the agent host. The skill covers opening pages, clicking and typing by snapshot reference, screenshots, tabs, storage, network mocking, tracing, video capture and a plan, generate and heal workflow for Playwright tests.

Researched 13 Nov 2026

In short.

This is an instruction skill from Microsoft that teaches an AI coding assistant to drive a real browser through the separate playwright-cli command-line tool. It is meant for developers who want an agent to explore, test and debug web pages. The main catch is that the skill does not include the tool, so playwright-cli has to be installed separately, and the commands it documents include ones that run JavaScript and handle cookies. Its front matter declares three allowed-tools patterns for playwright-cli and npx playwright commands. The evidence does not show what permissions or approval prompts those patterns produce, because that depends on the agent host. The skill is a SKILL.md plus ten reference files, taken from repository revision b21724888b8100b05ef8dee3a92f2bb03bf4dcde and licensed under Apache 2.0. It documents commands for sessions, snapshots with element references, input, tabs, storage, emulation, request routing, DevTools, tracing, video and Playwright test debugging. Nothing was executed for this report, so it does not assess how well the commands work with a current playwright-cli release.

Researched and written by an AI model and checked by a second AI model. How it works

Scope reviewed: the folder skills/playwright-cli in microsoft/playwright-cli at revision b21724888b8100b05ef8dee3a92f2bb03bf4dcde. That is eleven selected files: SKILL.md and its ten reference files (element-attributes, playwright-tests, pr-attachments, request-mocking, running-code, session-management, storage-state, test-generation, tracing, video-recording). The repository LICENSE (Apache License 2.0, Copyright (c) Microsoft Corporation) was included as the related notice, for twelve captured files in all. No NOTICE file was captured. Excluded: the playwright-cli program and its source code, other repository folders, linked pages such as playwright.dev, and the GitHub CLI. Not tested: no command was run, no browser was launched and no package was installed, so command behaviour, version compatibility, security behaviour, token cost, agent compatibility and how agent hosts handle the allowed-tools field are all unverified.

The overview

What this is

The resource is the folder skills/playwright-cli in the microsoft/playwright-cli repository. Its SKILL.md front matter names it playwright-cli and describes it as automating browser interactions, testing web pages and working with Playwright tests. The folder holds SKILL.md and ten files under references: element-attributes, playwright-tests, pr-attachments, request-mocking, running-code, session-management, storage-state, test-generation, tracing and video-recording. That makes eleven files in total. The repository LICENSE file is Apache License 2.0 with the notice Copyright (c) Microsoft Corporation.

This is an instruction skill. It contains documentation plus examples of shell commands and code that can be run, such as Playwright function snippets for run-code. It does not include the program that implements the CLI. The skill tells an agent which playwright-cli shell commands to run and in what order. The playwright-cli tool itself is outside the captured material.

Overall assessment

Judged on the text alone, this is a detailed and practical skill. SKILL.md gives a quick start and a list of commands, and every file it links to is in the captured folder. The reference files go beyond command lists into working procedures: attaching to a paused Playwright test with --debug=cli, a plan, generate and heal loop for writing tests, scripted video recordings, and attaching screenshots to pull requests.

Readers should weigh two things. First, the guidance is only useful if these instructions match the installed playwright-cli version, and that match was not checked. Second, the documented commands can do a lot. The front matter declares three allowed-tools patterns, covering playwright-cli, npx playwright and npx --no-install playwright commands. Those commands include eval, which runs JavaScript in the page, run-code, which runs a Playwright function against the page, and cookie commands that read or write session data. The evidence does not show what permissions or approval prompts the allowed-tools field produces, because that depends on the agent host. The skill suits developers who will supervise the agent. It is not suited to unattended use against logged-in accounts.

Who it is for

The main audience is developers and QA engineers who use an AI coding agent that supports skills and want it to operate a browser. Typical jobs are reproducing a UI bug, checking a form flow, inspecting network requests, or writing and repairing end-to-end tests. The test-generation guide assumes a Playwright workspace with a playwright.config file and a seed test, so those parts suit people who already use @playwright/test or are willing to adopt it.

Beginners can follow the quick start (open, goto, click, close), but the skill assumes you are comfortable with a terminal, npm and Node-based tools. It does not explain Playwright concepts from scratch. People who only need a one-off scrape or a manual browser check are unlikely to need it. The evidence does not say which agent products can load this skill format.

What it covers

Core commands: open, goto, click, dblclick, fill (with --submit), type, press, drag, drop, hover, select, upload, check, uncheck, snapshot, find (text or regular-expression search of the snapshot), eval, dialog-accept and dialog-dismiss, resize, and close. Other commands cover navigation (go-back, go-forward, reload), keyboard and mouse input, screenshots and PDF export, and tabs, which can optionally use isolated contexts.

Storage: commands for cookies, localStorage and sessionStorage, plus state-save and state-load to save and load the browser storage state. The example state file in storage-state.md shows cookies and localStorage entries. The captured files do not establish whether tabs, browsing history, sessionStorage or IndexedDB are restored. Emulation covers colour scheme, reduced motion, forced colours, contrast and print media. Network: route and unroute with status, body, header and header-removal options, and run-code for conditional mocking, changing responses, forced failures and delays.

DevTools and recording: console, requests, tracing-start and tracing-stop, recording-start and recording-stop (which prints recorded actions as Playwright code), video-start with chapters and action callouts, generate-locator, highlight, and show --annotate. The last one opens a dashboard where the user draws on the page and leaves notes for the agent. There is also an experimental WebMCP section: webmcp-list and webmcp-call let the agent use tools that a page registers for itself, and the skill labels those tools as untrusted input.

Workflows: running Playwright tests with PLAYWRIGHT_HTML_OPEN=never; debugging a failing test with --debug=cli followed by playwright-cli attach; a three-stage plan, generate and heal process for writing and repairing tests; and attaching screenshots and videos to GitHub pull requests with gh.

Using it

What you need

You need an agent that can load this skill folder and run shell commands, plus a way to run playwright-cli. SKILL.md sets this order. If a global playwright-cli command is available, use it. If not, check for a local Playwright with npx --no-install playwright --version, and if one is found, use npx playwright cli in all commands. Only if neither is available, install the global command with npm install -g @playwright/cli@latest. This implies Node.js and npm, but no minimum Node or CLI version is stated. SKILL.md also says that installing packages and running custom npm scripts may need separate approval.

Optional features have their own needs. Pull-request attachments need GitHub CLI (gh) version 2.99 or later and push access to the repository, and they work only on GitHub.com and GitHub Enterprise Cloud. The test workflows need @playwright/test in the project; the guide suggests npm init playwright@latest if it is missing. Attaching to a running Chrome or Edge by channel name needs remote debugging enabled in that browser. The captured files do not describe how the browsers themselves are installed.

How it works

The skill's front matter declares three allowed-tools patterns: Bash(playwright-cli:*), Bash(npx playwright:*) and Bash(npx --no-install playwright:*). The evidence does not show how an agent host reads that field or what permissions or approval prompts result; that depends on the host. In use, the agent drives a browser session through playwright-cli. After each command the tool returns the page status and a snapshot, saved as a YAML file under .playwright-cli. The snapshot lists page elements with short references such as e15, and the agent uses those references in later commands. CSS selectors and Playwright locators such as getByRole also work.

Every action prints the equivalent Playwright TypeScript. The test-generation guide uses that output as the raw material for test files, and assertions have to be added by hand. Browser sessions are named with -s. They are held in memory by default, and can use a profile saved on disk with --persistent or --profile. A headless session shuts itself down after an hour without commands; --idle-timeout changes that limit.

The run-code command takes a single async function expression and runs it against the page. The guide says the code runs in an isolated context rather than full Node.js, so require, process and Node modules are not available. To debug tests, the agent runs npx playwright test --debug=cli in the background, waits for a session name such as tw-abcdef, then connects with playwright-cli attach.

Setup

The files give no steps for installing the skill into any particular agent, so where to place the folder is unknown from this evidence. For the tool, SKILL.md sets this order. Use the global playwright-cli command if it is already available. If it is not, check for a local Playwright with npx --no-install playwright --version; if that works, use npx playwright cli in place of playwright-cli in all commands. Only if no local version is available, run npm install -g @playwright/cli@latest.

Once the tool is available, the quick start is: playwright-cli open, goto a URL, snapshot, interact using element references, and close. For test work, the guide asks you to confirm that a playwright.config.ts or playwright.config.js exists and to create a seed test that navigates to the app. Every planning or generation session should then start through that seed test with --debug=cli, not by opening the app URL directly.

Worked example

The form-submission example in SKILL.md shows the pattern. Run playwright-cli open https://example.com/form, take a snapshot to see the element references, fill e1 and e2 with values, click e3, take another snapshot, and close. The test-generation guide builds on this. Filling the email field prints the line await page.getByRole('textbox', { name: 'Email' }).fill('user@example.com'). The agent collects lines like this into a test file and adds an assertion such as await expect(page).toHaveURL(/.*dashboard/).

This is what the documents say the tool prints. Nothing was run for this report, so the actual output on any site is not verified.

Assessment & evidence

Limits and risks

Scope of the evidence: only the skill folder and the licence were reviewed. The playwright-cli program, its releases and its behaviour are outside the captured material, and nothing was run. These files come from one repository revision, but the documented global install uses @playwright/cli@latest, so the installed tool may differ from what the files describe. The files do not say which Playwright or playwright-cli versions are needed for particular commands or options, such as webmcp-call, drop, video-show-actions or --debug=cli, so those requirements are unknown. The only minimum version the files state is gh 2.99 or later for the --attach flag used in pull-request attachments.

Safety: the front matter declares allowed-tools patterns for playwright-cli and npx playwright commands. Whether a host runs matching commands without asking is unknown from this evidence. Commands that match these patterns include:

eval, which runs JavaScript in the page, for example to read document.title or an element's attributes.

run-code, which runs a single Playwright function with access to the page in an isolated context. running-code.md says require, process and Node modules are not available there, but timers, fetch and crypto are.

cookie-get, cookie-set and state-save, which read or write session credentials.

npx playwright test, which runs the project's own test code.

Sensitive data: the storage guide warns not to commit state files that contain auth tokens, to add them to .gitignore, and to delete them afterwards. Tracing records request and response headers and bodies, so a trace of a login or checkout flow can contain secrets. Attaching to a running Chrome or Edge with attach --cdp or --extension exposes that real browser's logged-in state to the agent. Several examples put passwords directly on the command line, which is fine for demos but not for real credentials. The skill says WebMCP tool names, descriptions, schemas and results come from the page and should be treated as untrusted input. The same caution applies to any page content an agent reads, because a web page could try to steer it.

Documentation differences: running-code.md shows a general example that waits for networkidle, while test-generation.md says never to use networkidle in its instructions for fixing failing tests. The two statements apply to different contexts, so they do not establish a contradiction. SKILL.md shows attach --extension=chrome, while session-management.md shows attach --extension. These are two documented variants, and whether both work with a given CLI version was not tested.

Why this assessment

The assessment is based on reading all twelve captured files at one revision: SKILL.md, its ten reference files and the repository licence. The skill is concrete rather than promotional. It gives exact commands, flags, file paths, limits and ordering rules, and it sets some firm rules: run debug sessions in the background and stop them afterwards, never add sleeps as a fix, and stop to ask the user when a test failure might be a bug in the app. These details support the view that it is meant for real agent use.

The cautions come from what the commands can do, not from any sign of bad intent. Anything that reads cookies, runs page code or attaches to a live browser deserves care, whoever made it. No claims can be made about reliability, speed or accuracy, because none were measured and the files report no benchmarks.

Alternatives and trade-offs

The evidence names no competing skills, so comparing this with other products would be speculation. The skill itself points to two related approaches. For repeatable tests, the end product is ordinary Playwright Test code run with npx playwright test, and the CLI is a tool for exploring and repairing those tests. When no CLI command fits, run-code lets the agent pass a single Playwright function expression. That function can perform several browser actions in one call, as running-code.md and video-recording.md show, but it runs without a full Node.js environment, so require, process and Node modules are not available.

Trade-off: a CLI skill that works from snapshot references keeps each step small and easy to inspect in a terminal. In exchange, the CLI must be installed, and browser sessions stay open between commands, so they need to be cleaned up with close or close-all, or with kill-all for stale processes. Whether other browser-control tools or agent integrations fit better depends on your agent and is not assessed here.

Evidence used

Reviewed in full: SKILL.md (about 15.7 KB); the ten reference files element-attributes (665 bytes), playwright-tests (1.7 KB), pr-attachments (2.8 KB), request-mocking (2.2 KB), running-code (6.0 KB), session-management (5.9 KB), storage-state (5.3 KB), test-generation (16.1 KB), tracing (3.6 KB) and video-recording (9.4 KB); and the repository LICENSE (11.6 KB). All were fetched from raw.githubusercontent.com at commit b21724888b8100b05ef8dee3a92f2bb03bf4dcde.

Findings are stated as what the documents say. No command was run, no browser was launched and no package was installed, so none of the described behaviour has been tested.

Access & freshness

Costs

The captured files state no price for the skill or for playwright-cli. The Apache 2.0 licence grants a no-charge copyright licence, but that is a licence term and says nothing about services you may add. Costs for the AI agent that runs the skill, model usage, GitHub plans and any infrastructure are not covered and remain unknown.

One practical cost is token use, because snapshots of large pages can be big. To keep them smaller, the skill suggests using find to search a snapshot, snapshot --depth, snapshots of a single element, and open --mobile, since mobile pages are usually lighter. Disk space is another cost: traces and videos can grow large, and the tracing guide shows a find command that deletes traces older than seven days. GitHub limits video attachments to 10 MB on free plans and 100 MB on paid plans.

Licence and reuse rights

The repository LICENSE is the Apache License, Version 2.0, with the notice Copyright (c) Microsoft Corporation. It grants a perpetual, worldwide, non-exclusive, no-charge, royalty-free copyright licence to reproduce the work, prepare derivative works, publicly display and perform it, sublicense it and distribute it in source or object form. Each contributor also grants a patent licence. That patent licence ends for anyone who starts patent litigation, including a cross-claim or counterclaim, alleging that the work or a contribution incorporated in it directly or contributorily infringes a patent. It ends on the date that litigation is filed.

Redistribution has four conditions. First, give recipients a copy of the licence. Second, make any modified files carry prominent notices stating that you changed them. Third, in the source form of any derivative works you distribute, keep all copyright, patent, trademark and attribution notices from the source form of the work, except notices that do not relate to any part of the derivative works. Fourth, if the work includes a NOTICE text file, include a readable copy of its attribution notices, except those that do not relate to the derivative works. That copy can go in a NOTICE file, in the source or documentation, or in a display the derivative works generate. The licence gives no permission to use the licensor's trade names, trademarks, service marks or product names, except as needed for reasonable and customary use in describing where the work came from and in reproducing the NOTICE file's content. The work is provided as is, without warranties, and the licence limits contributors' liability for damages.

The licence file is at the repository root. The skill files have no licence header of their own in the captured text. No NOTICE file was captured, so it is unknown whether one exists and what attribution it would require. Terms for playwright-cli, Playwright, the browsers and gh are not covered by this folder.

Freshness

The files were captured on 13 November 2026 at commit b21724888b8100b05ef8dee3a92f2bb03bf4dcde, from the folder on the main branch. The evidence does not include the commit date, release tags or the playwright-cli version these instructions are written for, so it is unknown how current the skill is compared with the latest tool release.

At this revision the files document gh 2.99 or later for attachments, the Pixel 10 and iPhone 17 as the default devices for mobile emulation, WebMCP support (described as experimental) and the page.screencast APIs for video. When these features were added, how actively the skill is maintained and whether they match current releases are all unknown. The evidence shows no deprecation or archive notice.

Suggested next steps

Before relying on the skill, install playwright-cli in a scratch project and check a few documented commands (open, snapshot, click, find, run-code) against the installed version. Write down that version for later.

Before enabling the skill, find out how your agent host handles the allowed-tools field. The front matter declares patterns for playwright-cli and npx playwright commands, and whether matching commands run without prompts depends on the host. For tighter control, require approval for each command if your host allows it, and review every run-code, eval, cookie and state-save call. Use the default in-memory profile, throwaway or test accounts, and a fixed local or staging site. Avoid attaching to your everyday browser profile, keep state and trace files out of version control, and delete them when you are done.

If you plan to use the test workflow, check that your Playwright version supports --debug=cli and that a seed test exists. Read the full licence before redistributing a modified copy, and keep the Apache 2.0 text and the Microsoft copyright notice with it.

Evidence for this report

LICENSEnotice · checked 2026-11-13
skills/playwright-cli/SKILL.mdselected · checked 2026-11-13
skills/playwright-cli/references/tracing.mdselected · checked 2026-11-13