@playwright/cli 0.0.62 → 0.0.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +99 -9
- package/package.json +4 -4
- package/playwright-cli.js +2 -2
package/README.md
CHANGED
|
@@ -27,6 +27,23 @@ npm install -g @playwright/cli@latest
|
|
|
27
27
|
playwright-cli --help
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
+
### Installing skills
|
|
31
|
+
|
|
32
|
+
Claude Code, GitHub Copilot and others will use the locally installed skills.
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
playwright-cli install-skills
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Skills-less operation
|
|
39
|
+
|
|
40
|
+
Point your agent at the CLI and let it cook. It'll read the skill off `playwright-cli --help` on its own:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
Test the "add todo" flow on https://demo.playwright.dev/todomvc using playwright-cli.
|
|
44
|
+
Check playwright-cli --help for available commands.
|
|
45
|
+
```
|
|
46
|
+
|
|
30
47
|
## Demo
|
|
31
48
|
|
|
32
49
|
```
|
|
@@ -88,13 +105,13 @@ Playwright CLI will use a dedicated persistent profile by default. It means that
|
|
|
88
105
|
your cookies and other storage state will be preserved between the calls. You can use different
|
|
89
106
|
instances of the browser for different projects with sessions.
|
|
90
107
|
|
|
91
|
-
Following will result in two browsers with separate profiles being available. Pass
|
|
108
|
+
Following will result in two browsers with separate profiles being available. Pass `-s=` to
|
|
92
109
|
the invocation to talk to a specific browser.
|
|
93
110
|
|
|
94
111
|
```bash
|
|
95
112
|
playwright-cli open https://playwright.dev
|
|
96
|
-
playwright-cli
|
|
97
|
-
playwright-cli
|
|
113
|
+
playwright-cli -s=example open https://example.com
|
|
114
|
+
playwright-cli list
|
|
98
115
|
```
|
|
99
116
|
|
|
100
117
|
You can run your coding agent with the `PLAYWRIGHT_CLI_SESSION` environment variable:
|
|
@@ -103,15 +120,14 @@ You can run your coding agent with the `PLAYWRIGHT_CLI_SESSION` environment vari
|
|
|
103
120
|
PLAYWRIGHT_CLI_SESSION=todo-app claude .
|
|
104
121
|
```
|
|
105
122
|
|
|
106
|
-
Or instruct it to prepend
|
|
123
|
+
Or instruct it to prepend `-s=` to the calls.
|
|
107
124
|
|
|
108
125
|
Manage your sessions as follows:
|
|
109
126
|
|
|
110
127
|
```bash
|
|
111
|
-
playwright-cli
|
|
112
|
-
playwright-cli
|
|
113
|
-
playwright-cli
|
|
114
|
-
playwright-cli session-delete [name] # delete session data along with the profiles
|
|
128
|
+
playwright-cli list # list all sessions
|
|
129
|
+
playwright-cli close-all # close all browsers
|
|
130
|
+
playwright-cli kill-all # forcefully kill all browser processes
|
|
115
131
|
```
|
|
116
132
|
|
|
117
133
|
<!-- BEGIN GENERATED CLI HELP -->
|
|
@@ -134,6 +150,7 @@ playwright-cli upload <file> # upload one or multiple files
|
|
|
134
150
|
playwright-cli check <ref> # check a checkbox or radio button
|
|
135
151
|
playwright-cli uncheck <ref> # uncheck a checkbox or radio button
|
|
136
152
|
playwright-cli snapshot # capture page snapshot to obtain element ref
|
|
153
|
+
playwright-cli snapshot --filename=f # save snapshot to specific file
|
|
137
154
|
playwright-cli eval <func> [ref] # evaluate javascript expression on page or element
|
|
138
155
|
playwright-cli dialog-accept [prompt] # accept a dialog
|
|
139
156
|
playwright-cli dialog-dismiss # dismiss a dialog
|
|
@@ -169,7 +186,9 @@ playwright-cli mousewheel <dx> <dy> # scroll mouse wheel
|
|
|
169
186
|
|
|
170
187
|
```bash
|
|
171
188
|
playwright-cli screenshot [ref] # screenshot of the current page or element
|
|
189
|
+
playwright-cli screenshot --filename=f # save screenshot with specific filename
|
|
172
190
|
playwright-cli pdf # save page as pdf
|
|
191
|
+
playwright-cli pdf --filename=page.pdf # save pdf with specific filename
|
|
173
192
|
```
|
|
174
193
|
|
|
175
194
|
### Tabs
|
|
@@ -181,6 +200,42 @@ playwright-cli tab-close [index] # close a browser tab
|
|
|
181
200
|
playwright-cli tab-select <index> # select a browser tab
|
|
182
201
|
```
|
|
183
202
|
|
|
203
|
+
### Storage
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
playwright-cli state-save [filename] # save storage state
|
|
207
|
+
playwright-cli state-load <filename> # load storage state
|
|
208
|
+
|
|
209
|
+
# Cookies
|
|
210
|
+
playwright-cli cookie-list [--domain] # list cookies
|
|
211
|
+
playwright-cli cookie-get <name> # get a cookie
|
|
212
|
+
playwright-cli cookie-set <name> <val> # set a cookie
|
|
213
|
+
playwright-cli cookie-delete <name> # delete a cookie
|
|
214
|
+
playwright-cli cookie-clear # clear all cookies
|
|
215
|
+
|
|
216
|
+
# LocalStorage
|
|
217
|
+
playwright-cli localstorage-list # list localStorage entries
|
|
218
|
+
playwright-cli localstorage-get <key> # get localStorage value
|
|
219
|
+
playwright-cli localstorage-set <k> <v> # set localStorage value
|
|
220
|
+
playwright-cli localstorage-delete <k> # delete localStorage entry
|
|
221
|
+
playwright-cli localstorage-clear # clear all localStorage
|
|
222
|
+
|
|
223
|
+
# SessionStorage
|
|
224
|
+
playwright-cli sessionstorage-list # list sessionStorage entries
|
|
225
|
+
playwright-cli sessionstorage-get <k> # get sessionStorage value
|
|
226
|
+
playwright-cli sessionstorage-set <k> <v> # set sessionStorage value
|
|
227
|
+
playwright-cli sessionstorage-delete <k> # delete sessionStorage entry
|
|
228
|
+
playwright-cli sessionstorage-clear # clear all sessionStorage
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Network
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
playwright-cli route <pattern> [opts] # mock network requests
|
|
235
|
+
playwright-cli route-list # list active routes
|
|
236
|
+
playwright-cli unroute [pattern] # remove route(s)
|
|
237
|
+
```
|
|
238
|
+
|
|
184
239
|
### DevTools
|
|
185
240
|
|
|
186
241
|
```bash
|
|
@@ -189,6 +244,39 @@ playwright-cli network # list all network requests since loadin
|
|
|
189
244
|
playwright-cli run-code <code> # run playwright code snippet
|
|
190
245
|
playwright-cli tracing-start # start trace recording
|
|
191
246
|
playwright-cli tracing-stop # stop trace recording
|
|
247
|
+
playwright-cli video-start # start video recording
|
|
248
|
+
playwright-cli video-stop [filename] # stop video recording
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Install
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
playwright-cli install-browser # install browser
|
|
255
|
+
playwright-cli install-skills # install skills
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### Configuration
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
playwright-cli config [options] # configure session settings
|
|
262
|
+
playwright-cli open --browser=chrome # use specific browser
|
|
263
|
+
playwright-cli open --extension # connect via browser extension
|
|
264
|
+
playwright-cli open --persistent # use persistent profile
|
|
265
|
+
playwright-cli open --profile=<path> # use custom profile directory
|
|
266
|
+
playwright-cli open --config=file.json # use config file
|
|
267
|
+
playwright-cli close # close the browser
|
|
268
|
+
playwright-cli delete-data # delete user data for default session
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### Sessions
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
playwright-cli -s=name <cmd> # run command in named session
|
|
275
|
+
playwright-cli -s=name close # stop a named browser
|
|
276
|
+
playwright-cli -s=name delete-data # delete user data for named browser
|
|
277
|
+
playwright-cli list # list all sessions
|
|
278
|
+
playwright-cli close-all # close all browsers
|
|
279
|
+
playwright-cli kill-all # forcefully kill all browser processes
|
|
192
280
|
```
|
|
193
281
|
<!-- END GENERATED CLI HELP -->
|
|
194
282
|
|
|
@@ -343,7 +431,8 @@ Playwright CLI will load config from `playwright-cli.json` by default so that yo
|
|
|
343
431
|
|
|
344
432
|
</details>
|
|
345
433
|
|
|
346
|
-
|
|
434
|
+
<details>
|
|
435
|
+
<summary>Configuration via env</summary>
|
|
347
436
|
|
|
348
437
|
| Environment |
|
|
349
438
|
|-------------|
|
|
@@ -389,3 +478,4 @@ Playwright CLI will load config from `playwright-cli.json` by default so that yo
|
|
|
389
478
|
| `PLAYWRIGHT_MCP_USER_AGENT` specify user agent string |
|
|
390
479
|
| `PLAYWRIGHT_MCP_USER_DATA_DIR` path to the user data directory. If not specified, a temporary directory will be created. |
|
|
391
480
|
| `PLAYWRIGHT_MCP_VIEWPORT_SIZE` specify browser viewport size in pixels, for example "1280x720" |
|
|
481
|
+
</details>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playwright/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.64",
|
|
4
4
|
"description": "Playwright CLI",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"scripts": {
|
|
18
18
|
"lint": "echo OK",
|
|
19
19
|
"build": "echo OK",
|
|
20
|
-
"test": "
|
|
20
|
+
"test": "playwright test"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"minimist": "^1.2.5",
|
|
24
|
-
"playwright": "1.59.0-alpha-
|
|
25
|
-
"playwright-core": "1.59.0-alpha-
|
|
24
|
+
"playwright": "1.59.0-alpha-1770338664000",
|
|
25
|
+
"playwright-core": "1.59.0-alpha-1770338664000"
|
|
26
26
|
},
|
|
27
27
|
"bin": {
|
|
28
28
|
"playwright-cli": "playwright-cli.js"
|
package/playwright-cli.js
CHANGED
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
const { program } = require('playwright/lib/mcp/terminal/program');
|
|
19
|
-
const
|
|
20
|
-
program(
|
|
19
|
+
const packageLocation = require.resolve('./package.json');
|
|
20
|
+
program(packageLocation).catch(e => {
|
|
21
21
|
console.error(e.message);
|
|
22
22
|
process.exit(1);
|
|
23
23
|
});
|