Browser Automation with playwright-cli

Automate browser interactions, test web pages and work with Playwright tests.

You say
Install this skill Read the source first Free Written by microsoft · unverified publisher
Context cost
14.7k tokensestimated from the bundle, loaded when it triggers
Bundle
10 files · 58.6 kBtext throughout, nothing executable
Licence
Apache-2.0free to use
Last change
no release on file
Servers it uses
Noneruns standalone

What it does

Automate browser interactions, test web pages and work with Playwright tests.

Installed, it changes the agent in these ways.

What this skill changes about the agent is not written down here yet. The listing was collected from its source, and the description is in its own SKILL.md.

Workflow

Runs a procedure end to end.

browserautomationplaywright

The skill itself

This is the whole product. A skill is instructions the model reads, so there is nothing behind the listing you cannot see first — the front matter loads with every session, and the body below it loads when the skill triggers.

SKILL.md12.6 kB · 421 lines
--- name: playwright-cli description: Automate browser interactions, test web pages and work with Playwright tests. allowed-tools: Bash(playwright-cli:*) Bash(npx:*) Bash(npm:*) ---
7# Browser Automation with playwright-cli
8
9## Quick start
10
11```bash
12# open new browser
13playwright-cli open
14# navigate to a page
15playwright-cli goto https://playwright.dev
16# interact with the page using refs from the snapshot
17playwright-cli click e15
18playwright-cli type "page.click"
19playwright-cli press Enter
20# take a screenshot (rarely used, as snapshot is more common)
21playwright-cli screenshot
22# close the browser
23playwright-cli close
24```
25
26## Commands
27
28### Core
29
30```bash
31playwright-cli open
32# open and navigate right away
33playwright-cli open https://example.com/
34playwright-cli goto https://playwright.dev
35playwright-cli type "search query"
36playwright-cli click e3
37playwright-cli dblclick e7
38# --submit presses Enter after filling the element
39playwright-cli fill e5 "user@example.com" --submit
40playwright-cli drag e2 e8
41# drop files or data onto an element (from outside the page)
42playwright-cli drop e4 --path=./image.png
43playwright-cli drop e4 --data="text/plain=hello world"
44playwright-cli hover e4
45playwright-cli select e9 "option-value"
46playwright-cli upload ./document.pdf
47playwright-cli check e12
48playwright-cli uncheck e12
49playwright-cli snapshot
50# search the snapshot for text or a regexp, returns matching nodes with surrounding context
51playwright-cli find "Sign in"
52playwright-cli find --regex "Sign (in|up)"
53# wrap the regexp in slashes to add flags, e.g. /i for case-insensitive
54playwright-cli find --regex "/sign (in|up)/i"
55playwright-cli eval "document.title"
56playwright-cli eval "el => el.textContent" e5
57# get element id, class, or any attribute not visible in the snapshot
58playwright-cli eval "el => el.id" e5
59playwright-cli eval "el => el.getAttribute('data-testid')" e5
60playwright-cli dialog-accept
61playwright-cli dialog-accept "confirmation text"
62playwright-cli dialog-dismiss
63playwright-cli resize 1920 1080
64playwright-cli close
65```
66
67### Navigation
68
69```bash
70playwright-cli go-back
71playwright-cli go-forward
72playwright-cli reload
73```
74
75### Keyboard
76
77```bash
78playwright-cli press Enter
79playwright-cli press ArrowDown
80playwright-cli keydown Shift
81playwright-cli keyup Shift
82```
83
84### Mouse
85
86```bash
87playwright-cli mousemove 150 300
88playwright-cli mousedown
89playwright-cli mousedown right
90playwright-cli mouseup
91playwright-cli mouseup right
92playwright-cli mousewheel 0 100
93```
94
95### Save as
96
97```bash
98playwright-cli screenshot
99playwright-cli screenshot e5
100playwright-cli screenshot --filename=page.png
101playwright-cli screenshot --hires
102playwright-cli pdf --filename=page.pdf
103```
104
105### Tabs
106
107```bash
108playwright-cli tab-list
109playwright-cli tab-new
110playwright-cli tab-new https://example.com/page
111playwright-cli tab-close
112playwright-cli tab-close 2
113playwright-cli tab-select 0
114```
115
116### Storage
117
118```bash
119playwright-cli state-save
120playwright-cli state-save auth.json
121playwright-cli state-load auth.json
122
123# Cookies
124playwright-cli cookie-list
125playwright-cli cookie-list --domain=example.com
126playwright-cli cookie-get session_id
127playwright-cli cookie-set session_id abc123
128playwright-cli cookie-set session_id abc123 --domain=example.com --httpOnly --secure
129playwright-cli cookie-delete session_id
130playwright-cli cookie-clear
131
132# LocalStorage
133playwright-cli localstorage-list
134playwright-cli localstorage-get theme
135playwright-cli localstorage-set theme dark
136playwright-cli localstorage-delete theme
137playwright-cli localstorage-clear
138
139# SessionStorage
140playwright-cli sessionstorage-list
141playwright-cli sessionstorage-get step
142playwright-cli sessionstorage-set step 3
143playwright-cli sessionstorage-delete step
144playwright-cli sessionstorage-clear
145```
146
147### Network
148
149```bash
150playwright-cli route "**/*.jpg" --status=404
151playwright-cli route "https://api.example.com/**" --body='{"mock": true}'
152playwright-cli route-list
153playwright-cli unroute "**/*.jpg"
154playwright-cli unroute
155```
156
157### DevTools
158
159```bash
160playwright-cli console
161playwright-cli console warning
162playwright-cli requests
163playwright-cli request 5
164playwright-cli run-code "async page => await page.context().grantPermissions(['geolocation'])"
165playwright-cli run-code --filename=script.js
166playwright-cli tracing-start
167playwright-cli tracing-stop
168playwright-cli video-start video.webm
169playwright-cli video-chapter "Chapter Title" --description="Details" --duration=2000
170playwright-cli video-stop
171
172# annotate each subsequent action (click, type, ...) with a callout naming the action and highlighting the target
173playwright-cli video-show-actions --duration=600 --position=top-right
174playwright-cli video-hide-actions
175
176# launch the dashboard for UI review / design feedback — user annotates the page, you receive the annotated screenshot, snapshot, and notes
177playwright-cli show --annotate
178
179# generate a Playwright locator for an element from its ref or selector
180playwright-cli generate-locator e5 --raw
181
182# show a persistent highlight overlay for an element, optionally with a custom style
183playwright-cli highlight e5
184playwright-cli highlight e5 --style="outline: 3px dashed red"
185# hide a single element highlight, or all page highlights when no target is given
186playwright-cli highlight e5 --hide
187playwright-cli highlight --hide
188```
189
190## Raw output
191
192The global --raw option strips page status, generated code, and snapshot sections from the output, returning only the result value. Use it to pipe command output into other tools. Commands that don't produce output return nothing.
193
194```bash
195playwright-cli --raw eval "JSON.stringify(performance.timing)" | jq '.loadEventEnd - .navigationStart'
196playwright-cli --raw eval "JSON.stringify([...document.querySelectorAll('a')].map(a => a.href))" > links.json
197playwright-cli --raw snapshot > before.yml
198playwright-cli click e5
199playwright-cli --raw snapshot > after.yml
200diff before.yml after.yml
201TOKEN=$(playwright-cli --raw cookie-get session_id)
202playwright-cli --raw localstorage-get theme
203```
204
205For structured output wrapping every reply as JSON, pass --json
206```bash
207playwright-cli list --json
208```
209
210## Open parameters
211```bash
212# Use specific browser when creating session
213playwright-cli open --browser=chrome
214playwright-cli open --browser=firefox
215playwright-cli open --browser=webkit
216playwright-cli open --browser=msedge
217
218# Emulate a generic mobile device (Pixel 10 for Chromium, iPhone 17 for WebKit).
219# Prefer this when a mobile layout is acceptable: mobile pages are usually
220# lighter, so snapshots are smaller and cheaper.
221playwright-cli open --mobile
222playwright-cli open --device="iPhone 15"
223
224# Use persistent profile (by default profile is in-memory)
225playwright-cli open --persistent
226# Use persistent profile with custom directory
227playwright-cli open --profile=/path/to/profile
228
229# Connect to browser via Playwright Extension
230playwright-cli attach --extension=chrome
231
232# Connect to a running Chrome or Edge by channel name
233playwright-cli attach --cdp=chrome
234playwright-cli attach --cdp=msedge
235
236# Connect to a running browser via CDP endpoint
237playwright-cli attach --cdp=http://localhost:9222
238
239# Start with config file
240playwright-cli open --config=my-config.json
241
242# Close the browser
243playwright-cli close
244# Detach from an attached browser (leaves the external browser running)
245playwright-cli -s=msedge detach
246# Delete user data for the default session
247playwright-cli delete-data
248```
249
250## URLs with & on Windows
251
252On Windows, cmd.exe and PowerShell treat & as a command separator, so URLs with multiple query parameters get truncated before playwright-cli runs. Escape & with ^& in cmd.exe, or use --% in PowerShell:
253
254```batch
255playwright-cli goto "https://example.com/?a=1^&b=2"
256```
257
258```powershell
259playwright-cli --% goto "https://example.com/?a=1&b=2"
260```
261
262## Snapshots
263
264After each command, playwright-cli provides a snapshot of the current browser state.
265
266```bash
267> playwright-cli goto https://example.com
268### Page
269- Page URL: https://example.com/
270- Page Title: Example Domain
271### Snapshot
272[Snapshot](.playwright-cli/page-2026-02-14T19-22-42-679Z.yml)
273```
274
275You can also take a snapshot on demand using playwright-cli snapshot command. All the options below can be combined as needed.
276
277```bash
278# default - save to a file with timestamp-based name
279playwright-cli snapshot
280
281# save to file, use when snapshot is a part of the workflow result
282playwright-cli snapshot --filename=after-click.yaml
283
284# snapshot an element instead of the whole page
285playwright-cli snapshot "#main"
286
287# limit snapshot depth for efficiency, take a partial snapshot afterwards
288playwright-cli snapshot --depth=4
289playwright-cli snapshot e34
290
291# include each element's bounding box as [box=x,y,width,height]
292playwright-cli snapshot --boxes
293
294# search a large snapshot instead of capturing it all — returns matching nodes
295# with 3 lines of context around each match (like grep -C)
296playwright-cli find "Add to cart"
297playwright-cli find --regex "\\$[0-9]+\\.[0-9]{2}"
298```
299
300## Targeting elements
301
302By default, use refs from the snapshot to interact with page elements.
303
304```bash
305# get snapshot with refs
306playwright-cli snapshot
307
308# interact using a ref
309playwright-cli click e15
310```
311
312You can also use css selectors or Playwright locators.
313
314```bash
315# css selector
316playwright-cli click "#main > button.submit"
317
318# role locator
319playwright-cli click "getByRole('button', { name: 'Submit' })"
320
321# test id
322playwright-cli click "getByTestId('submit-button')"
323```
324
325## Browser Sessions
326
327```bash
328# create new browser session named "mysession" with persistent profile
329playwright-cli -s=mysession open example.com --persistent
330# same with manually specified profile directory (use when requested explicitly)
331playwright-cli -s=mysession open example.com --profile=/path/to/profile
332playwright-cli -s=mysession click e6
333playwright-cli -s=mysession close # stop a named browser
334playwright-cli -s=mysession delete-data # delete user data for persistent session
335
336playwright-cli list
337# Close all browsers
338playwright-cli close-all
339# Forcefully kill all browser processes
340playwright-cli kill-all
341```
342
343## Installation
344
345If global playwright-cli command is not available, try a local version via npx playwright cli:
346
347```bash
348npx --no-install playwright --version
349```
350
351When local version is available, use npx playwright cli in all commands. Otherwise, install playwright-cli as a global command:
352
353```bash
354npm install -g @playwright/cli@latest
355```
356
357## Example: Form submission
358
359```bash
360playwright-cli open https://example.com/form
361playwright-cli snapshot
362
363playwright-cli fill e1 "user@example.com"
364playwright-cli fill e2 "password123"
365playwright-cli click e3
366playwright-cli snapshot
367playwright-cli close
368```
369
370## Example: Multi-tab workflow
371
372```bash
373playwright-cli open https://example.com
374playwright-cli tab-new https://example.com/other
375playwright-cli tab-list
376playwright-cli tab-select 0
377playwright-cli snapshot
378playwright-cli close
379```
380
381## Example: Debugging with DevTools
382
383```bash
384playwright-cli open https://example.com
385playwright-cli click e4
386playwright-cli fill e7 "test"
387playwright-cli console
388playwright-cli requests
389playwright-cli close
390```
391
392```bash
393playwright-cli open https://example.com
394playwright-cli tracing-start
395playwright-cli click e4
396playwright-cli fill e7 "test"
397playwright-cli tracing-stop
398playwright-cli close
399```
400
401## Example: Interactive session
402
403Ask the user for UI review or design feedback. The user draws boxes on the live page and types comments; you receive the annotated screenshot, the snapshot of the marked region, and the user's notes. Use this whenever the user asks for "UI review", "design feedback", or to "ask the user what they think / want / mean":
404
405```bash
406playwright-cli open https://example.com
407playwright-cli show --annotate
408```
409
410## Specific tasks
411
412* **Running and Debugging Playwright tests** [references/playwright-tests.md](references/playwright-tests.md)
413* **Request mocking** [references/request-mocking.md](references/request-mocking.md)
414* **Running Playwright code** [references/running-code.md](references/running-code.md)
415* **Browser session management** [references/session-management.md](references/session-management.md)
416* **Storage state (cookies, localStorage)** [references/storage-state.md](references/storage-state.md)
417* **Test generation (plan / generate / heal)** [references/test-generation.md](references/test-generation.md)
418* **Tracing** [references/tracing.md](references/tracing.md)
419* **Video recording** [references/video-recording.md](references/video-recording.md)
420* **Inspecting element attributes** [references/element-attributes.md](references/element-attributes.md)
421
In the file
SKILL.md1,457 words
Files10
LicenceApache-2.0
Why you can read it

Nothing in a skill executes. The client loads the text and the model follows it, so a skill can be audited the way a runbook is — by reading it.

What it costs in context

Skills are not billed by the call. They are paid for in context: every token the instructions occupy is a token your code, your diff and your conversation cannot use. Here is what this one takes and when it takes it.

≈50
always loaded
The name and description, so the model knows the skill exists and when to reach for it.
14,600
on trigger
The instruction body and 9 supporting files, read only when the skill fires.
7.3%
of a 200k window
Ten skills this size would take about 73% of the window before you open a file.
050k100k150k200k context window

14.7k tokens, estimated from the bundle at four bytes to the token, held for the rest of the session once it triggers. Heavy. Teams tend to install this one per project rather than globally, and load it only when the job comes up.

Servers bill, skills cost

A server charges by the month. A skill charges once per session, in context, and then keeps charging it for as long as the session lives.

Before and after

The same question, put to the same model twice: once as it comes, and once with these instructions loaded.

No worked example has been published for this skill yet.

Adoption
Installsnone yet
Ratingno reviews yet

The procedure it runs

The procedure has not been published here. It is in the skill’s own SKILL.md, which its author has not sent to the marketplace yet.

Prose, not code

These steps are written for a model to follow, not executed by a runtime. It can still be told to skip one, and it will say so when it does.

Servers it uses

None. This skill calls no MCP servers at all.

Everything it needs is in the instructions, so it works in a project with nothing connected — the model reads the file and changes how it works with what it can already reach.

It writes no files and reaches no network. All it changes is how the model reasons and writes.

What it asks for
Writes filesno
Network accessno

Read from the allowed-tools line of this skill’s own SKILL.md. A skill grants no permissions of its own — it can only ask for tools your client already has.

What it will not do

Every skill is narrow, and the useful ones say where they stop. These are the jobs this one is the wrong tool for.

What this skill is not for has not been published here. Nothing is implied by that: it is a section the author has not filled in.

What is in the bundle

10 files, 58.6 kB on disk. A bundle is text throughout: the instructions the model reads, plus the templates it fills in.

  • SKILL.md12.6 kB
  • references/element-attributes.md0.7 kB
  • references/playwright-tests.md1.7 kB
  • references/request-mocking.md2.2 kB
  • references/running-code.md5.6 kB
  • references/session-management.md5.7 kB
  • references/storage-state.md5.2 kB
  • references/test-generation.md16.1 kB
  • references/tracing.md3.4 kB
  • references/video-recording.md5.4 kB
What is not in it

No dependencies and nothing executable: a skill is text the agent reads, so the bundle is 10 files you can review in full before installing. The Apache-2.0 licence covers the templates and examples as well as the instructions.

Install

Installing copies the bundle into your project. Nothing runs at install time — the files sit on disk until the model reads them.

# Browser Automation with playwright-cli · 14.7k tokens when loaded npx mcprush@latest skill add microsoft/browser-automation-with-playwright-cli

Writes to .claude/skills/browser-automation-with-playwright-cli/ in the current project. Add --global to put it in your home directory instead, for every project.

Which clients pick it up on their own

A skill is a folder of text. A client with a skills folder reads it without being told; everywhere else the same text works, it is just handed to the model rather than found.

Claude Code.claude/skills/
Claude Desktop
ChatGPT
Cursor.cursor/skills/
VS Code.github/skills/
Codex CLI.agents/skills/
Gemini CLI.gemini/skills/
Grok.grok/skills/
Zed.agents/skills/
Windsurf.windsurf/skills/
Agent SDK.claude/skills/
HTTP / API
This release
Versionnot versioned
Publishedno release date on file
PriceFree
Referencemicrosoft/browser-automation-with-playwright-cli

Versions

Its author publishes no version number, so there is nothing here to pin to: what you install is the folder as it stands today. Instructions change more often than APIs do — a skill can be rewritten entirely without anything it depends on moving.

v
  • No earlier releases have been published to the marketplace.
Pinning

Nothing to pin to: this skill carries no version number of its own. What you install is what the folder holds on the day you install it.

Reviews

no reviews yet · no installs yet

Nobody has reviewed this skill yet. The rating is the mean of the reviews written here, so there is none until somebody writes the first.

Who can post

Only accounts that have had the skill installed for fourteen days, so a review is written after living with it rather than after reading it. Publishers may reply once.

Who wrote it

MI
microsoft

Publishes on mcprush.

0 servers listed2 skills listednot claimed
Profile
Publisher
Servers0
Claim this skill