@willbooster/agent-skills 1.21.0 → 1.21.2
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/dist/cli.js +3 -3
- package/package.json +2 -2
- package/skills/playwright-cli/SKILL.md +157 -150
- package/skills/playwright-cli/references/element-attributes.md +6 -6
- package/skills/playwright-cli/references/playwright-tests.md +1 -1
- package/skills/playwright-cli/references/request-mocking.md +11 -11
- package/skills/playwright-cli/references/running-code.md +28 -28
- package/skills/playwright-cli/references/session-management.md +80 -40
- package/skills/playwright-cli/references/storage-state.md +41 -41
- package/skills/playwright-cli/references/test-generation.md +8 -8
- package/skills/playwright-cli/references/tracing.md +22 -22
- package/skills/playwright-cli/references/video-recording.md +13 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/agent-skills",
|
|
3
|
-
"version": "1.21.
|
|
3
|
+
"version": "1.21.2",
|
|
4
4
|
"description": "A collection of agent skills for WillBooster Inc.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@semantic-release/release-notes-generator": "14.1.0",
|
|
46
46
|
"@tsconfig/bun": "1.0.10",
|
|
47
47
|
"@types/bun": "1.3.12",
|
|
48
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
48
|
+
"@typescript/native-preview": "7.0.0-dev.20260419.1",
|
|
49
49
|
"@willbooster/oxfmt-config": "1.2.1",
|
|
50
50
|
"@willbooster/oxlint-config": "1.4.4",
|
|
51
51
|
"@willbooster/wb": "13.11.8",
|
|
@@ -10,17 +10,17 @@ allowed-tools: Bash(playwright-cli:*) Bash(npx:*) Bash(npm:*)
|
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
12
|
# open new browser
|
|
13
|
-
bunx @playwright/cli@
|
|
13
|
+
bunx @playwright/cli@0.1.8 open
|
|
14
14
|
# navigate to a page
|
|
15
|
-
bunx @playwright/cli@
|
|
15
|
+
bunx @playwright/cli@0.1.8 goto https://playwright.dev
|
|
16
16
|
# interact with the page using refs from the snapshot
|
|
17
|
-
bunx @playwright/cli@
|
|
18
|
-
bunx @playwright/cli@
|
|
19
|
-
bunx @playwright/cli@
|
|
17
|
+
bunx @playwright/cli@0.1.8 click e15
|
|
18
|
+
bunx @playwright/cli@0.1.8 type "page.click"
|
|
19
|
+
bunx @playwright/cli@0.1.8 press Enter
|
|
20
20
|
# take a screenshot (rarely used, as snapshot is more common)
|
|
21
|
-
bunx @playwright/cli@
|
|
21
|
+
bunx @playwright/cli@0.1.8 screenshot
|
|
22
22
|
# close the browser
|
|
23
|
-
bunx @playwright/cli@
|
|
23
|
+
bunx @playwright/cli@0.1.8 close
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
## Commands
|
|
@@ -28,136 +28,136 @@ bunx @playwright/cli@latest close
|
|
|
28
28
|
### Core
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
|
-
bunx @playwright/cli@
|
|
31
|
+
bunx @playwright/cli@0.1.8 open
|
|
32
32
|
# open and navigate right away
|
|
33
|
-
bunx @playwright/cli@
|
|
34
|
-
bunx @playwright/cli@
|
|
35
|
-
bunx @playwright/cli@
|
|
36
|
-
bunx @playwright/cli@
|
|
37
|
-
bunx @playwright/cli@
|
|
33
|
+
bunx @playwright/cli@0.1.8 open https://example.com/
|
|
34
|
+
bunx @playwright/cli@0.1.8 goto https://playwright.dev
|
|
35
|
+
bunx @playwright/cli@0.1.8 type "search query"
|
|
36
|
+
bunx @playwright/cli@0.1.8 click e3
|
|
37
|
+
bunx @playwright/cli@0.1.8 dblclick e7
|
|
38
38
|
# --submit presses Enter after filling the element
|
|
39
|
-
bunx @playwright/cli@
|
|
40
|
-
bunx @playwright/cli@
|
|
41
|
-
bunx @playwright/cli@
|
|
42
|
-
bunx @playwright/cli@
|
|
43
|
-
bunx @playwright/cli@
|
|
44
|
-
bunx @playwright/cli@
|
|
45
|
-
bunx @playwright/cli@
|
|
46
|
-
bunx @playwright/cli@
|
|
47
|
-
bunx @playwright/cli@
|
|
48
|
-
bunx @playwright/cli@
|
|
39
|
+
bunx @playwright/cli@0.1.8 fill e5 "user@example.com" --submit
|
|
40
|
+
bunx @playwright/cli@0.1.8 drag e2 e8
|
|
41
|
+
bunx @playwright/cli@0.1.8 hover e4
|
|
42
|
+
bunx @playwright/cli@0.1.8 select e9 "option-value"
|
|
43
|
+
bunx @playwright/cli@0.1.8 upload ./document.pdf
|
|
44
|
+
bunx @playwright/cli@0.1.8 check e12
|
|
45
|
+
bunx @playwright/cli@0.1.8 uncheck e12
|
|
46
|
+
bunx @playwright/cli@0.1.8 snapshot
|
|
47
|
+
bunx @playwright/cli@0.1.8 eval "document.title"
|
|
48
|
+
bunx @playwright/cli@0.1.8 eval "el => el.textContent" e5
|
|
49
49
|
# get element id, class, or any attribute not visible in the snapshot
|
|
50
|
-
bunx @playwright/cli@
|
|
51
|
-
bunx @playwright/cli@
|
|
52
|
-
bunx @playwright/cli@
|
|
53
|
-
bunx @playwright/cli@
|
|
54
|
-
bunx @playwright/cli@
|
|
55
|
-
bunx @playwright/cli@
|
|
56
|
-
bunx @playwright/cli@
|
|
50
|
+
bunx @playwright/cli@0.1.8 eval "el => el.id" e5
|
|
51
|
+
bunx @playwright/cli@0.1.8 eval "el => el.getAttribute('data-testid')" e5
|
|
52
|
+
bunx @playwright/cli@0.1.8 dialog-accept
|
|
53
|
+
bunx @playwright/cli@0.1.8 dialog-accept "confirmation text"
|
|
54
|
+
bunx @playwright/cli@0.1.8 dialog-dismiss
|
|
55
|
+
bunx @playwright/cli@0.1.8 resize 1920 1080
|
|
56
|
+
bunx @playwright/cli@0.1.8 close
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
### Navigation
|
|
60
60
|
|
|
61
61
|
```bash
|
|
62
|
-
bunx @playwright/cli@
|
|
63
|
-
bunx @playwright/cli@
|
|
64
|
-
bunx @playwright/cli@
|
|
62
|
+
bunx @playwright/cli@0.1.8 go-back
|
|
63
|
+
bunx @playwright/cli@0.1.8 go-forward
|
|
64
|
+
bunx @playwright/cli@0.1.8 reload
|
|
65
65
|
```
|
|
66
66
|
|
|
67
67
|
### Keyboard
|
|
68
68
|
|
|
69
69
|
```bash
|
|
70
|
-
bunx @playwright/cli@
|
|
71
|
-
bunx @playwright/cli@
|
|
72
|
-
bunx @playwright/cli@
|
|
73
|
-
bunx @playwright/cli@
|
|
70
|
+
bunx @playwright/cli@0.1.8 press Enter
|
|
71
|
+
bunx @playwright/cli@0.1.8 press ArrowDown
|
|
72
|
+
bunx @playwright/cli@0.1.8 keydown Shift
|
|
73
|
+
bunx @playwright/cli@0.1.8 keyup Shift
|
|
74
74
|
```
|
|
75
75
|
|
|
76
76
|
### Mouse
|
|
77
77
|
|
|
78
78
|
```bash
|
|
79
|
-
bunx @playwright/cli@
|
|
80
|
-
bunx @playwright/cli@
|
|
81
|
-
bunx @playwright/cli@
|
|
82
|
-
bunx @playwright/cli@
|
|
83
|
-
bunx @playwright/cli@
|
|
84
|
-
bunx @playwright/cli@
|
|
79
|
+
bunx @playwright/cli@0.1.8 mousemove 150 300
|
|
80
|
+
bunx @playwright/cli@0.1.8 mousedown
|
|
81
|
+
bunx @playwright/cli@0.1.8 mousedown right
|
|
82
|
+
bunx @playwright/cli@0.1.8 mouseup
|
|
83
|
+
bunx @playwright/cli@0.1.8 mouseup right
|
|
84
|
+
bunx @playwright/cli@0.1.8 mousewheel 0 100
|
|
85
85
|
```
|
|
86
86
|
|
|
87
87
|
### Save as
|
|
88
88
|
|
|
89
89
|
```bash
|
|
90
|
-
bunx @playwright/cli@
|
|
91
|
-
bunx @playwright/cli@
|
|
92
|
-
bunx @playwright/cli@
|
|
93
|
-
bunx @playwright/cli@
|
|
90
|
+
bunx @playwright/cli@0.1.8 screenshot
|
|
91
|
+
bunx @playwright/cli@0.1.8 screenshot e5
|
|
92
|
+
bunx @playwright/cli@0.1.8 screenshot --filename=page.png
|
|
93
|
+
bunx @playwright/cli@0.1.8 pdf --filename=page.pdf
|
|
94
94
|
```
|
|
95
95
|
|
|
96
96
|
### Tabs
|
|
97
97
|
|
|
98
98
|
```bash
|
|
99
|
-
bunx @playwright/cli@
|
|
100
|
-
bunx @playwright/cli@
|
|
101
|
-
bunx @playwright/cli@
|
|
102
|
-
bunx @playwright/cli@
|
|
103
|
-
bunx @playwright/cli@
|
|
104
|
-
bunx @playwright/cli@
|
|
99
|
+
bunx @playwright/cli@0.1.8 tab-list
|
|
100
|
+
bunx @playwright/cli@0.1.8 tab-new
|
|
101
|
+
bunx @playwright/cli@0.1.8 tab-new https://example.com/page
|
|
102
|
+
bunx @playwright/cli@0.1.8 tab-close
|
|
103
|
+
bunx @playwright/cli@0.1.8 tab-close 2
|
|
104
|
+
bunx @playwright/cli@0.1.8 tab-select 0
|
|
105
105
|
```
|
|
106
106
|
|
|
107
107
|
### Storage
|
|
108
108
|
|
|
109
109
|
```bash
|
|
110
|
-
bunx @playwright/cli@
|
|
111
|
-
bunx @playwright/cli@
|
|
112
|
-
bunx @playwright/cli@
|
|
110
|
+
bunx @playwright/cli@0.1.8 state-save
|
|
111
|
+
bunx @playwright/cli@0.1.8 state-save auth.json
|
|
112
|
+
bunx @playwright/cli@0.1.8 state-load auth.json
|
|
113
113
|
|
|
114
114
|
# Cookies
|
|
115
|
-
bunx @playwright/cli@
|
|
116
|
-
bunx @playwright/cli@
|
|
117
|
-
bunx @playwright/cli@
|
|
118
|
-
bunx @playwright/cli@
|
|
119
|
-
bunx @playwright/cli@
|
|
120
|
-
bunx @playwright/cli@
|
|
121
|
-
bunx @playwright/cli@
|
|
115
|
+
bunx @playwright/cli@0.1.8 cookie-list
|
|
116
|
+
bunx @playwright/cli@0.1.8 cookie-list --domain=example.com
|
|
117
|
+
bunx @playwright/cli@0.1.8 cookie-get session_id
|
|
118
|
+
bunx @playwright/cli@0.1.8 cookie-set session_id abc123
|
|
119
|
+
bunx @playwright/cli@0.1.8 cookie-set session_id abc123 --domain=example.com --httpOnly --secure
|
|
120
|
+
bunx @playwright/cli@0.1.8 cookie-delete session_id
|
|
121
|
+
bunx @playwright/cli@0.1.8 cookie-clear
|
|
122
122
|
|
|
123
123
|
# LocalStorage
|
|
124
|
-
bunx @playwright/cli@
|
|
125
|
-
bunx @playwright/cli@
|
|
126
|
-
bunx @playwright/cli@
|
|
127
|
-
bunx @playwright/cli@
|
|
128
|
-
bunx @playwright/cli@
|
|
124
|
+
bunx @playwright/cli@0.1.8 localstorage-list
|
|
125
|
+
bunx @playwright/cli@0.1.8 localstorage-get theme
|
|
126
|
+
bunx @playwright/cli@0.1.8 localstorage-set theme dark
|
|
127
|
+
bunx @playwright/cli@0.1.8 localstorage-delete theme
|
|
128
|
+
bunx @playwright/cli@0.1.8 localstorage-clear
|
|
129
129
|
|
|
130
130
|
# SessionStorage
|
|
131
|
-
bunx @playwright/cli@
|
|
132
|
-
bunx @playwright/cli@
|
|
133
|
-
bunx @playwright/cli@
|
|
134
|
-
bunx @playwright/cli@
|
|
135
|
-
bunx @playwright/cli@
|
|
131
|
+
bunx @playwright/cli@0.1.8 sessionstorage-list
|
|
132
|
+
bunx @playwright/cli@0.1.8 sessionstorage-get step
|
|
133
|
+
bunx @playwright/cli@0.1.8 sessionstorage-set step 3
|
|
134
|
+
bunx @playwright/cli@0.1.8 sessionstorage-delete step
|
|
135
|
+
bunx @playwright/cli@0.1.8 sessionstorage-clear
|
|
136
136
|
```
|
|
137
137
|
|
|
138
138
|
### Network
|
|
139
139
|
|
|
140
140
|
```bash
|
|
141
|
-
bunx @playwright/cli@
|
|
142
|
-
bunx @playwright/cli@
|
|
143
|
-
bunx @playwright/cli@
|
|
144
|
-
bunx @playwright/cli@
|
|
145
|
-
bunx @playwright/cli@
|
|
141
|
+
bunx @playwright/cli@0.1.8 route "**/*.jpg" --status=404
|
|
142
|
+
bunx @playwright/cli@0.1.8 route "https://api.example.com/**" --body='{"mock": true}'
|
|
143
|
+
bunx @playwright/cli@0.1.8 route-list
|
|
144
|
+
bunx @playwright/cli@0.1.8 unroute "**/*.jpg"
|
|
145
|
+
bunx @playwright/cli@0.1.8 unroute
|
|
146
146
|
```
|
|
147
147
|
|
|
148
148
|
### DevTools
|
|
149
149
|
|
|
150
150
|
```bash
|
|
151
|
-
bunx @playwright/cli@
|
|
152
|
-
bunx @playwright/cli@
|
|
153
|
-
bunx @playwright/cli@
|
|
154
|
-
bunx @playwright/cli@
|
|
155
|
-
bunx @playwright/cli@
|
|
156
|
-
bunx @playwright/cli@
|
|
157
|
-
bunx @playwright/cli@
|
|
158
|
-
bunx @playwright/cli@
|
|
159
|
-
bunx @playwright/cli@
|
|
160
|
-
bunx @playwright/cli@
|
|
151
|
+
bunx @playwright/cli@0.1.8 console
|
|
152
|
+
bunx @playwright/cli@0.1.8 console warning
|
|
153
|
+
bunx @playwright/cli@0.1.8 network
|
|
154
|
+
bunx @playwright/cli@0.1.8 run-code "async page => await page.context().grantPermissions(['geolocation'])"
|
|
155
|
+
bunx @playwright/cli@0.1.8 run-code --filename=script.js
|
|
156
|
+
bunx @playwright/cli@0.1.8 tracing-start
|
|
157
|
+
bunx @playwright/cli@0.1.8 tracing-stop
|
|
158
|
+
bunx @playwright/cli@0.1.8 video-start video.webm
|
|
159
|
+
bunx @playwright/cli@0.1.8 video-chapter "Chapter Title" --description="Details" --duration=2000
|
|
160
|
+
bunx @playwright/cli@0.1.8 video-stop
|
|
161
161
|
```
|
|
162
162
|
|
|
163
163
|
## Raw output
|
|
@@ -165,40 +165,47 @@ bunx @playwright/cli@latest video-stop
|
|
|
165
165
|
The 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.
|
|
166
166
|
|
|
167
167
|
```bash
|
|
168
|
-
bunx @playwright/cli@
|
|
169
|
-
bunx @playwright/cli@
|
|
170
|
-
bunx @playwright/cli@
|
|
171
|
-
bunx @playwright/cli@
|
|
172
|
-
bunx @playwright/cli@
|
|
168
|
+
bunx @playwright/cli@0.1.8 --raw eval "JSON.stringify(performance.timing)" | jq '.loadEventEnd - .navigationStart'
|
|
169
|
+
bunx @playwright/cli@0.1.8 --raw eval "JSON.stringify([...document.querySelectorAll('a')].map(a => a.href))" > links.json
|
|
170
|
+
bunx @playwright/cli@0.1.8 --raw snapshot > before.yml
|
|
171
|
+
bunx @playwright/cli@0.1.8 click e5
|
|
172
|
+
bunx @playwright/cli@0.1.8 --raw snapshot > after.yml
|
|
173
173
|
diff before.yml after.yml
|
|
174
|
-
TOKEN=$(bunx @playwright/cli@
|
|
175
|
-
bunx @playwright/cli@
|
|
174
|
+
TOKEN=$(bunx @playwright/cli@0.1.8 --raw cookie-get session_id)
|
|
175
|
+
bunx @playwright/cli@0.1.8 --raw localstorage-get theme
|
|
176
176
|
```
|
|
177
177
|
|
|
178
178
|
## Open parameters
|
|
179
179
|
|
|
180
180
|
```bash
|
|
181
181
|
# Use specific browser when creating session
|
|
182
|
-
bunx @playwright/cli@
|
|
183
|
-
bunx @playwright/cli@
|
|
184
|
-
bunx @playwright/cli@
|
|
185
|
-
bunx @playwright/cli@
|
|
182
|
+
bunx @playwright/cli@0.1.8 open --browser=chrome
|
|
183
|
+
bunx @playwright/cli@0.1.8 open --browser=firefox
|
|
184
|
+
bunx @playwright/cli@0.1.8 open --browser=webkit
|
|
185
|
+
bunx @playwright/cli@0.1.8 open --browser=msedge
|
|
186
186
|
|
|
187
187
|
# Use persistent profile (by default profile is in-memory)
|
|
188
|
-
bunx @playwright/cli@
|
|
188
|
+
bunx @playwright/cli@0.1.8 open --persistent
|
|
189
189
|
# Use persistent profile with custom directory
|
|
190
|
-
bunx @playwright/cli@
|
|
190
|
+
bunx @playwright/cli@0.1.8 open --profile=/path/to/profile
|
|
191
191
|
|
|
192
192
|
# Connect to browser via extension
|
|
193
|
-
bunx @playwright/cli@
|
|
193
|
+
bunx @playwright/cli@0.1.8 attach --extension
|
|
194
|
+
|
|
195
|
+
# Connect to a running Chrome or Edge by channel name
|
|
196
|
+
bunx @playwright/cli@0.1.8 attach --cdp=chrome
|
|
197
|
+
bunx @playwright/cli@0.1.8 attach --cdp=msedge
|
|
198
|
+
|
|
199
|
+
# Connect to a running browser via CDP endpoint
|
|
200
|
+
bunx @playwright/cli@0.1.8 attach --cdp=http://localhost:9222
|
|
194
201
|
|
|
195
202
|
# Start with config file
|
|
196
|
-
bunx @playwright/cli@
|
|
203
|
+
bunx @playwright/cli@0.1.8 open --config=my-config.json
|
|
197
204
|
|
|
198
205
|
# Close the browser
|
|
199
|
-
bunx @playwright/cli@
|
|
206
|
+
bunx @playwright/cli@0.1.8 close
|
|
200
207
|
# Delete user data for the default session
|
|
201
|
-
bunx @playwright/cli@
|
|
208
|
+
bunx @playwright/cli@0.1.8 delete-data
|
|
202
209
|
```
|
|
203
210
|
|
|
204
211
|
## Snapshots
|
|
@@ -206,7 +213,7 @@ bunx @playwright/cli@latest delete-data
|
|
|
206
213
|
After each command, playwright-cli provides a snapshot of the current browser state.
|
|
207
214
|
|
|
208
215
|
```bash
|
|
209
|
-
> bunx @playwright/cli@
|
|
216
|
+
> bunx @playwright/cli@0.1.8 goto https://example.com
|
|
210
217
|
### Page
|
|
211
218
|
- Page URL: https://example.com/
|
|
212
219
|
- Page Title: Example Domain
|
|
@@ -218,17 +225,17 @@ You can also take a snapshot on demand using `playwright-cli snapshot` command.
|
|
|
218
225
|
|
|
219
226
|
```bash
|
|
220
227
|
# default - save to a file with timestamp-based name
|
|
221
|
-
bunx @playwright/cli@
|
|
228
|
+
bunx @playwright/cli@0.1.8 snapshot
|
|
222
229
|
|
|
223
230
|
# save to file, use when snapshot is a part of the workflow result
|
|
224
|
-
bunx @playwright/cli@
|
|
231
|
+
bunx @playwright/cli@0.1.8 snapshot --filename=after-click.yaml
|
|
225
232
|
|
|
226
233
|
# snapshot an element instead of the whole page
|
|
227
|
-
bunx @playwright/cli@
|
|
234
|
+
bunx @playwright/cli@0.1.8 snapshot "#main"
|
|
228
235
|
|
|
229
236
|
# limit snapshot depth for efficiency, take a partial snapshot afterwards
|
|
230
|
-
bunx @playwright/cli@
|
|
231
|
-
bunx @playwright/cli@
|
|
237
|
+
bunx @playwright/cli@0.1.8 snapshot --depth=4
|
|
238
|
+
bunx @playwright/cli@0.1.8 snapshot e34
|
|
232
239
|
```
|
|
233
240
|
|
|
234
241
|
## Targeting elements
|
|
@@ -237,85 +244,85 @@ By default, use refs from the snapshot to interact with page elements.
|
|
|
237
244
|
|
|
238
245
|
```bash
|
|
239
246
|
# get snapshot with refs
|
|
240
|
-
bunx @playwright/cli@
|
|
247
|
+
bunx @playwright/cli@0.1.8 snapshot
|
|
241
248
|
|
|
242
249
|
# interact using a ref
|
|
243
|
-
bunx @playwright/cli@
|
|
250
|
+
bunx @playwright/cli@0.1.8 click e15
|
|
244
251
|
```
|
|
245
252
|
|
|
246
253
|
You can also use css selectors or Playwright locators.
|
|
247
254
|
|
|
248
255
|
```bash
|
|
249
256
|
# css selector
|
|
250
|
-
bunx @playwright/cli@
|
|
257
|
+
bunx @playwright/cli@0.1.8 click "#main > button.submit"
|
|
251
258
|
|
|
252
259
|
# role locator
|
|
253
|
-
bunx @playwright/cli@
|
|
260
|
+
bunx @playwright/cli@0.1.8 click "getByRole('button', { name: 'Submit' })"
|
|
254
261
|
|
|
255
262
|
# test id
|
|
256
|
-
bunx @playwright/cli@
|
|
263
|
+
bunx @playwright/cli@0.1.8 click "getByTestId('submit-button')"
|
|
257
264
|
```
|
|
258
265
|
|
|
259
266
|
## Browser Sessions
|
|
260
267
|
|
|
261
268
|
```bash
|
|
262
269
|
# create new browser session named "mysession" with persistent profile
|
|
263
|
-
bunx @playwright/cli@
|
|
270
|
+
bunx @playwright/cli@0.1.8 -s=mysession open example.com --persistent
|
|
264
271
|
# same with manually specified profile directory (use when requested explicitly)
|
|
265
|
-
bunx @playwright/cli@
|
|
266
|
-
bunx @playwright/cli@
|
|
267
|
-
bunx @playwright/cli@
|
|
268
|
-
bunx @playwright/cli@
|
|
272
|
+
bunx @playwright/cli@0.1.8 -s=mysession open example.com --profile=/path/to/profile
|
|
273
|
+
bunx @playwright/cli@0.1.8 -s=mysession click e6
|
|
274
|
+
bunx @playwright/cli@0.1.8 -s=mysession close # stop a named browser
|
|
275
|
+
bunx @playwright/cli@0.1.8 -s=mysession delete-data # delete user data for persistent session
|
|
269
276
|
|
|
270
|
-
bunx @playwright/cli@
|
|
277
|
+
bunx @playwright/cli@0.1.8 list
|
|
271
278
|
# Close all browsers
|
|
272
|
-
bunx @playwright/cli@
|
|
279
|
+
bunx @playwright/cli@0.1.8 close-all
|
|
273
280
|
# Forcefully kill all browser processes
|
|
274
|
-
bunx @playwright/cli@
|
|
281
|
+
bunx @playwright/cli@0.1.8 kill-all
|
|
275
282
|
```
|
|
276
283
|
|
|
277
284
|
## Example: Form submission
|
|
278
285
|
|
|
279
286
|
```bash
|
|
280
|
-
bunx @playwright/cli@
|
|
281
|
-
bunx @playwright/cli@
|
|
282
|
-
|
|
283
|
-
bunx @playwright/cli@
|
|
284
|
-
bunx @playwright/cli@
|
|
285
|
-
bunx @playwright/cli@
|
|
286
|
-
bunx @playwright/cli@
|
|
287
|
-
bunx @playwright/cli@
|
|
287
|
+
bunx @playwright/cli@0.1.8 open https://example.com/form
|
|
288
|
+
bunx @playwright/cli@0.1.8 snapshot
|
|
289
|
+
|
|
290
|
+
bunx @playwright/cli@0.1.8 fill e1 "user@example.com"
|
|
291
|
+
bunx @playwright/cli@0.1.8 fill e2 "password123"
|
|
292
|
+
bunx @playwright/cli@0.1.8 click e3
|
|
293
|
+
bunx @playwright/cli@0.1.8 snapshot
|
|
294
|
+
bunx @playwright/cli@0.1.8 close
|
|
288
295
|
```
|
|
289
296
|
|
|
290
297
|
## Example: Multi-tab workflow
|
|
291
298
|
|
|
292
299
|
```bash
|
|
293
|
-
bunx @playwright/cli@
|
|
294
|
-
bunx @playwright/cli@
|
|
295
|
-
bunx @playwright/cli@
|
|
296
|
-
bunx @playwright/cli@
|
|
297
|
-
bunx @playwright/cli@
|
|
298
|
-
bunx @playwright/cli@
|
|
300
|
+
bunx @playwright/cli@0.1.8 open https://example.com
|
|
301
|
+
bunx @playwright/cli@0.1.8 tab-new https://example.com/other
|
|
302
|
+
bunx @playwright/cli@0.1.8 tab-list
|
|
303
|
+
bunx @playwright/cli@0.1.8 tab-select 0
|
|
304
|
+
bunx @playwright/cli@0.1.8 snapshot
|
|
305
|
+
bunx @playwright/cli@0.1.8 close
|
|
299
306
|
```
|
|
300
307
|
|
|
301
308
|
## Example: Debugging with DevTools
|
|
302
309
|
|
|
303
310
|
```bash
|
|
304
|
-
bunx @playwright/cli@
|
|
305
|
-
bunx @playwright/cli@
|
|
306
|
-
bunx @playwright/cli@
|
|
307
|
-
bunx @playwright/cli@
|
|
308
|
-
bunx @playwright/cli@
|
|
309
|
-
bunx @playwright/cli@
|
|
311
|
+
bunx @playwright/cli@0.1.8 open https://example.com
|
|
312
|
+
bunx @playwright/cli@0.1.8 click e4
|
|
313
|
+
bunx @playwright/cli@0.1.8 fill e7 "test"
|
|
314
|
+
bunx @playwright/cli@0.1.8 console
|
|
315
|
+
bunx @playwright/cli@0.1.8 network
|
|
316
|
+
bunx @playwright/cli@0.1.8 close
|
|
310
317
|
```
|
|
311
318
|
|
|
312
319
|
```bash
|
|
313
|
-
bunx @playwright/cli@
|
|
314
|
-
bunx @playwright/cli@
|
|
315
|
-
bunx @playwright/cli@
|
|
316
|
-
bunx @playwright/cli@
|
|
317
|
-
bunx @playwright/cli@
|
|
318
|
-
bunx @playwright/cli@
|
|
320
|
+
bunx @playwright/cli@0.1.8 open https://example.com
|
|
321
|
+
bunx @playwright/cli@0.1.8 tracing-start
|
|
322
|
+
bunx @playwright/cli@0.1.8 click e4
|
|
323
|
+
bunx @playwright/cli@0.1.8 fill e7 "test"
|
|
324
|
+
bunx @playwright/cli@0.1.8 tracing-stop
|
|
325
|
+
bunx @playwright/cli@0.1.8 close
|
|
319
326
|
```
|
|
320
327
|
|
|
321
328
|
## Specific tasks
|
|
@@ -5,19 +5,19 @@ When the snapshot doesn't show an element's `id`, `class`, `data-*` attributes,
|
|
|
5
5
|
## Examples
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
bunx @playwright/cli@
|
|
8
|
+
bunx @playwright/cli@0.1.8 snapshot
|
|
9
9
|
# snapshot shows a button as e7 but doesn't reveal its id or data attributes
|
|
10
10
|
|
|
11
11
|
# get the element's id
|
|
12
|
-
bunx @playwright/cli@
|
|
12
|
+
bunx @playwright/cli@0.1.8 eval "el => el.id" e7
|
|
13
13
|
|
|
14
14
|
# get all CSS classes
|
|
15
|
-
bunx @playwright/cli@
|
|
15
|
+
bunx @playwright/cli@0.1.8 eval "el => el.className" e7
|
|
16
16
|
|
|
17
17
|
# get a specific attribute
|
|
18
|
-
bunx @playwright/cli@
|
|
19
|
-
bunx @playwright/cli@
|
|
18
|
+
bunx @playwright/cli@0.1.8 eval "el => el.getAttribute('data-testid')" e7
|
|
19
|
+
bunx @playwright/cli@0.1.8 eval "el => el.getAttribute('aria-label')" e7
|
|
20
20
|
|
|
21
21
|
# get a computed style property
|
|
22
|
-
bunx @playwright/cli@
|
|
22
|
+
bunx @playwright/cli@0.1.8 eval "el => getComputedStyle(el).display" e7
|
|
23
23
|
```
|
|
@@ -26,7 +26,7 @@ PLAYWRIGHT_HTML_OPEN=never npx playwright test --debug=cli
|
|
|
26
26
|
# ...
|
|
27
27
|
|
|
28
28
|
# Attach to the test
|
|
29
|
-
bunx @playwright/cli@
|
|
29
|
+
bunx @playwright/cli@0.1.8 attach tw-abcdef
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
Keep the test running in the background while you explore and look for a fix.
|
|
@@ -6,23 +6,23 @@ Intercept, mock, modify, and block network requests.
|
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
# Mock with custom status
|
|
9
|
-
bunx @playwright/cli@
|
|
9
|
+
bunx @playwright/cli@0.1.8 route "**/*.jpg" --status=404
|
|
10
10
|
|
|
11
11
|
# Mock with JSON body
|
|
12
|
-
bunx @playwright/cli@
|
|
12
|
+
bunx @playwright/cli@0.1.8 route "**/api/users" --body='[{"id":1,"name":"Alice"}]' --content-type=application/json
|
|
13
13
|
|
|
14
14
|
# Mock with custom headers
|
|
15
|
-
bunx @playwright/cli@
|
|
15
|
+
bunx @playwright/cli@0.1.8 route "**/api/data" --body='{"ok":true}' --header="X-Custom: value"
|
|
16
16
|
|
|
17
17
|
# Remove headers from requests
|
|
18
|
-
bunx @playwright/cli@
|
|
18
|
+
bunx @playwright/cli@0.1.8 route "**/*" --remove-header=cookie,authorization
|
|
19
19
|
|
|
20
20
|
# List active routes
|
|
21
|
-
bunx @playwright/cli@
|
|
21
|
+
bunx @playwright/cli@0.1.8 route-list
|
|
22
22
|
|
|
23
23
|
# Remove a route or all routes
|
|
24
|
-
bunx @playwright/cli@
|
|
25
|
-
bunx @playwright/cli@
|
|
24
|
+
bunx @playwright/cli@0.1.8 unroute "**/*.jpg"
|
|
25
|
+
bunx @playwright/cli@0.1.8 unroute
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
## URL Patterns
|
|
@@ -41,7 +41,7 @@ For conditional responses, request body inspection, response modification, or de
|
|
|
41
41
|
### Conditional Response Based on Request
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
|
-
bunx @playwright/cli@
|
|
44
|
+
bunx @playwright/cli@0.1.8 run-code "async page => {
|
|
45
45
|
await page.route('**/api/login', route => {
|
|
46
46
|
const body = route.request().postDataJSON();
|
|
47
47
|
if (body.username === 'admin') {
|
|
@@ -56,7 +56,7 @@ bunx @playwright/cli@latest run-code "async page => {
|
|
|
56
56
|
### Modify Real Response
|
|
57
57
|
|
|
58
58
|
```bash
|
|
59
|
-
bunx @playwright/cli@
|
|
59
|
+
bunx @playwright/cli@0.1.8 run-code "async page => {
|
|
60
60
|
await page.route('**/api/user', async route => {
|
|
61
61
|
const response = await route.fetch();
|
|
62
62
|
const json = await response.json();
|
|
@@ -69,7 +69,7 @@ bunx @playwright/cli@latest run-code "async page => {
|
|
|
69
69
|
### Simulate Network Failures
|
|
70
70
|
|
|
71
71
|
```bash
|
|
72
|
-
bunx @playwright/cli@
|
|
72
|
+
bunx @playwright/cli@0.1.8 run-code "async page => {
|
|
73
73
|
await page.route('**/api/offline', route => route.abort('internetdisconnected'));
|
|
74
74
|
}"
|
|
75
75
|
# Options: connectionrefused, timedout, connectionreset, internetdisconnected
|
|
@@ -78,7 +78,7 @@ bunx @playwright/cli@latest run-code "async page => {
|
|
|
78
78
|
### Delayed Response
|
|
79
79
|
|
|
80
80
|
```bash
|
|
81
|
-
bunx @playwright/cli@
|
|
81
|
+
bunx @playwright/cli@0.1.8 run-code "async page => {
|
|
82
82
|
await page.route('**/api/slow', async route => {
|
|
83
83
|
await new Promise(r => setTimeout(r, 3000));
|
|
84
84
|
route.fulfill({ body: JSON.stringify({ data: 'loaded' }) });
|