@agent-smith/feat-frontend 0.0.1 → 0.0.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/actions/playwright-cli-playbook.js +74 -0
- package/dist/actions/playwright-cli.js +8 -6
- package/dist/agents/browser-agent.yml +3 -10
- package/dist/agents/frontend-assistant.yml +3 -3
- package/dist/agents/frontend-light.yml +0 -2
- package/dist/agents/frontend-team.yml +5 -4
- package/dist/agents/frontend.yml +0 -2
- package/dist/fragments/agents-manager-ts.md +1 -3
- package/dist/skills/playwright-cli/SKILL.md +5 -196
- package/dist/skills/playwright-cli-full/SKILL.md +403 -0
- package/dist/skills/playwright-cli-full/references/element-attributes.md +23 -0
- package/dist/skills/playwright-cli-full/references/playwright-tests.md +39 -0
- package/dist/skills/playwright-cli-full/references/request-mocking.md +87 -0
- package/dist/skills/playwright-cli-full/references/running-code.md +241 -0
- package/dist/skills/playwright-cli-full/references/session-management.md +225 -0
- package/dist/skills/playwright-cli-full/references/storage-state.md +275 -0
- package/dist/skills/playwright-cli-full/references/test-generation.md +433 -0
- package/dist/skills/playwright-cli-full/references/tracing.md +139 -0
- package/dist/skills/playwright-cli-full/references/video-recording.md +143 -0
- package/dist/skills/playwright-cli-mini/SKILL.md +164 -0
- package/dist/skills/playwright-cli-mini/references/element-attributes.md +23 -0
- package/dist/skills/playwright-cli-mini/references/playwright-tests.md +39 -0
- package/dist/skills/playwright-cli-mini/references/request-mocking.md +87 -0
- package/dist/skills/playwright-cli-mini/references/running-code.md +241 -0
- package/dist/skills/playwright-cli-mini/references/session-management.md +225 -0
- package/dist/skills/playwright-cli-mini/references/storage-state.md +275 -0
- package/dist/skills/playwright-cli-mini/references/test-generation.md +433 -0
- package/dist/skills/playwright-cli-mini/references/tracing.md +139 -0
- package/dist/skills/playwright-cli-mini/references/video-recording.md +143 -0
- package/package.json +1 -1
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/*
|
|
2
|
+
# tool
|
|
3
|
+
name: playwright-cli-playbook
|
|
4
|
+
description: "Run Playwright cli commands. Load the `playwright-cli` skill to understand the api"
|
|
5
|
+
arguments:
|
|
6
|
+
commands:
|
|
7
|
+
description: |-
|
|
8
|
+
"The playwright-cli commands to run: an array of commands. Example: ["open https://playwright.dev --headed", "snapshot"]
|
|
9
|
+
required: true
|
|
10
|
+
*/
|
|
11
|
+
import { utils } from "@agent-smith/core";
|
|
12
|
+
import { parseArgsStringToArgv } from 'string-argv';
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
async function action(args, options) {
|
|
16
|
+
//console.log("ARGS", args);
|
|
17
|
+
const ar = JSON.parse(args.commands);
|
|
18
|
+
//console.log("CMDS", ar);
|
|
19
|
+
//return "ok";
|
|
20
|
+
if (options?.variables?.workspace) {
|
|
21
|
+
} else {
|
|
22
|
+
throw new Error("no workspace var");
|
|
23
|
+
}
|
|
24
|
+
//write only in workspace
|
|
25
|
+
ar.forEach(v => {
|
|
26
|
+
if (v.includes("--filename=")) {
|
|
27
|
+
const p = v.replace("--filename=").trim();
|
|
28
|
+
if (!p.startsWith("/workspace")) {
|
|
29
|
+
return "The filename argument must be a path starting with /workspace";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (v.includes("--profile=")) {
|
|
33
|
+
const p = v.replace("--profile=").trim();
|
|
34
|
+
if (!p.startsWith("/workspace")) {
|
|
35
|
+
return "The profile argument must be a path starting with /workspace";
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
const vars = [];
|
|
40
|
+
ar.forEach(a => {
|
|
41
|
+
if (a.includes("/workspace")) {
|
|
42
|
+
a = a.replaceAll("/workspace", options.variables.workspace);
|
|
43
|
+
}
|
|
44
|
+
if (a.startsWith("open")) {
|
|
45
|
+
if (!a.includes("--headed")) {
|
|
46
|
+
return `${a}: please use the --headed flag with the open command so the user can see the operations`;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
vars.push(a);
|
|
50
|
+
});
|
|
51
|
+
console.log("Executing playwright-cli playbook", vars.length, "operations:");
|
|
52
|
+
const endRes = [];
|
|
53
|
+
for (const v of vars) {
|
|
54
|
+
const errBuf = [];
|
|
55
|
+
//console.log("Executing", v);
|
|
56
|
+
const execArgs = parseArgsStringToArgv(v.trim());
|
|
57
|
+
console.log("Executing", execArgs);
|
|
58
|
+
let r = await utils.execute("playwright-cli", execArgs, {
|
|
59
|
+
onStderr: (e) => errBuf.push(e.toString())
|
|
60
|
+
});
|
|
61
|
+
if (errBuf.length > 0) {
|
|
62
|
+
r = "[Error]: " + errBuf.join("\n");
|
|
63
|
+
} else {
|
|
64
|
+
r = `${v}:\n${r}`;
|
|
65
|
+
}
|
|
66
|
+
endRes.push(r.toString().replaceAll(options.variables.workspace, "/workspace"));
|
|
67
|
+
}
|
|
68
|
+
//console.log("RES", res);
|
|
69
|
+
return endRes.join("\n");
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export {
|
|
73
|
+
action,
|
|
74
|
+
};
|
|
@@ -3,17 +3,19 @@
|
|
|
3
3
|
name: playwright-cli
|
|
4
4
|
description: "Run a Playwright cli command. Load the `playwright-cli` skill to understand the api"
|
|
5
5
|
arguments:
|
|
6
|
-
|
|
6
|
+
command:
|
|
7
7
|
description: |-
|
|
8
|
-
|
|
8
|
+
the playwright-cli command line. Example: open https://playwright.dev --headed
|
|
9
9
|
required: true
|
|
10
10
|
*/
|
|
11
11
|
import { utils } from "@agent-smith/core";
|
|
12
|
-
import
|
|
13
|
-
|
|
12
|
+
import parseArgsStringToArgv from "string-argv";
|
|
14
13
|
|
|
15
14
|
async function action(args, options) {
|
|
16
|
-
|
|
15
|
+
if (args.command.startsWith("playwright-cli")) {
|
|
16
|
+
args.command = args.command.replace("playwright-cli", "").trim();
|
|
17
|
+
}
|
|
18
|
+
const ar = parseArgsStringToArgv(args.command.replaceAll("\\", ""));
|
|
17
19
|
if (options?.variables?.workspace) {
|
|
18
20
|
} else {
|
|
19
21
|
throw new Error("no workspace var");
|
|
@@ -40,7 +42,7 @@ async function action(args, options) {
|
|
|
40
42
|
}
|
|
41
43
|
vars.push(a);
|
|
42
44
|
});
|
|
43
|
-
console.log("Executing playwright-cli", vars
|
|
45
|
+
console.log("Executing playwright-cli", vars);
|
|
44
46
|
const res = await utils.execute("playwright-cli", vars);
|
|
45
47
|
if (ar[0] == "screenshot") {
|
|
46
48
|
return "Screenshot saved";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
tool:
|
|
2
|
-
name:
|
|
2
|
+
name: browser-agent
|
|
3
3
|
description: An agent that has access to browser usage using Playwright
|
|
4
4
|
arguments:
|
|
5
5
|
prompt:
|
|
@@ -11,15 +11,13 @@ prompt: |-
|
|
|
11
11
|
{prompt}
|
|
12
12
|
template:
|
|
13
13
|
system: |-
|
|
14
|
-
You are Lynx Coder, a coding agent from Lynx AI.
|
|
15
|
-
|
|
16
14
|
Your task is to use a browser with playwright-cli. Constraints:
|
|
17
15
|
|
|
18
16
|
- You always work in headed mode: use the `--headed` flag with commands like `open`
|
|
17
|
+
- Never save screenshots unless asked
|
|
19
18
|
- Close the browser when you are done
|
|
20
|
-
- For screenshots use the `--filename` flag with absolute paths starting with /workspace. You don"t need to verify if he screenshots has been saved. Limit the size of the screenshots (max 1024px width).
|
|
21
19
|
|
|
22
|
-
Important: start by loading the `playwright-cli` skill to understand the api before running commands.
|
|
20
|
+
Important: start by loading the `playwright-cli-mini` skill to understand the api before running commands.
|
|
23
21
|
model: qwen35b
|
|
24
22
|
variables:
|
|
25
23
|
required:
|
|
@@ -28,8 +26,3 @@ variables:
|
|
|
28
26
|
toolsList:
|
|
29
27
|
- playwright-cli-headed
|
|
30
28
|
- load-skill
|
|
31
|
-
workflow:
|
|
32
|
-
before:
|
|
33
|
-
- adaptater: from-container
|
|
34
|
-
after:
|
|
35
|
-
- adaptater: to-container
|
|
@@ -4,8 +4,6 @@ prompt: |-
|
|
|
4
4
|
{prompt}
|
|
5
5
|
template:
|
|
6
6
|
system: |-
|
|
7
|
-
You are Lynx Coder, a coding agent from Lynx AI.
|
|
8
|
-
|
|
9
7
|
{file:../fragments/workspace.md}
|
|
10
8
|
|
|
11
9
|
{file:../fragments/ctx-helper-files.md}
|
|
@@ -32,6 +30,8 @@ toolsList:
|
|
|
32
30
|
- write-file
|
|
33
31
|
- edit-search-replace
|
|
34
32
|
- shell
|
|
33
|
+
- python
|
|
35
34
|
- browser-agent
|
|
36
35
|
- load-skill
|
|
37
|
-
- load-task
|
|
36
|
+
- load-task
|
|
37
|
+
- notify-user
|
|
@@ -4,7 +4,7 @@ prompt: |-
|
|
|
4
4
|
{prompt}
|
|
5
5
|
template:
|
|
6
6
|
system: |-
|
|
7
|
-
|
|
7
|
+
Your can organise the workflow of other agents. As a coordinator you can delegate tasks to agents to orchestrate the work and coordinate the team of agents. Available agents:
|
|
8
8
|
|
|
9
9
|
{file:../fragments/agents-manager-ts.md}
|
|
10
10
|
|
|
@@ -14,7 +14,7 @@ template:
|
|
|
14
14
|
|
|
15
15
|
Load the typescript-coding-guide skill when you need to code.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
For verifications you should rely on the browser agent. If you really need to visually check with a screenshot instruct the browser agent with the steps to accomplish (clicks,..), and to take a screenshot (make sure the directory exists before transmiting a path to an agent), then read back the screenshot to visualy inspect anything.
|
|
18
18
|
model: qwen35b
|
|
19
19
|
inferParams:
|
|
20
20
|
min_p: 0
|
|
@@ -37,5 +37,6 @@ toolsList:
|
|
|
37
37
|
- python
|
|
38
38
|
- run-agent
|
|
39
39
|
- load-skill
|
|
40
|
-
-
|
|
41
|
-
- load-image
|
|
40
|
+
- load-task
|
|
41
|
+
- load-image
|
|
42
|
+
- notify-user
|
package/dist/agents/frontend.yml
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
- `frontend-assistant`: a fork of yourself, the default agent. Run it by default to delegate any task.
|
|
2
|
-
- `browser-agent`: a junior agent that manage browser operations using Playwright. Use it to perform browser operations, like making screenshots. Always provide simple and direct instructions to this agent, no complex operations.
|
|
3
|
-
|
|
4
|
-
All the agents can read and write files and have the same tools as you.
|
|
2
|
+
- `browser-agent`: a junior agent that manage browser operations using Playwright. Use it to perform browser operations, like making screenshots. Always provide simple and direct instructions to this agent, no complex operations.
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: playwright-cli
|
|
3
3
|
description: Automate browser interactions, test web pages and work with Playwright tests.
|
|
4
|
-
allowed-tools: Bash(playwright-cli:*) Bash(npx:*) Bash(npm:*)
|
|
5
4
|
---
|
|
6
5
|
|
|
7
6
|
# Browser Automation with playwright-cli
|
|
@@ -15,12 +14,12 @@ playwright-cli open
|
|
|
15
14
|
playwright-cli open --headed
|
|
16
15
|
# navigate to a page
|
|
17
16
|
playwright-cli goto https://playwright.dev
|
|
17
|
+
# take a snapshot
|
|
18
|
+
playwright-cli snapshot
|
|
18
19
|
# interact with the page using refs from the snapshot
|
|
19
20
|
playwright-cli click e15
|
|
20
21
|
playwright-cli type "page.click"
|
|
21
22
|
playwright-cli press Enter
|
|
22
|
-
# take a screenshot (rarely used, as snapshot is more common)
|
|
23
|
-
playwright-cli screenshot
|
|
24
23
|
# close the browser
|
|
25
24
|
playwright-cli close
|
|
26
25
|
```
|
|
@@ -30,9 +29,7 @@ playwright-cli close
|
|
|
30
29
|
### Core
|
|
31
30
|
|
|
32
31
|
```bash
|
|
33
|
-
playwright-cli open
|
|
34
|
-
# open and navigate right away
|
|
35
|
-
playwright-cli open https://example.com/
|
|
32
|
+
playwright-cli open https://example.com/ --headed
|
|
36
33
|
playwright-cli goto https://playwright.dev
|
|
37
34
|
playwright-cli type "search query"
|
|
38
35
|
playwright-cli click e3
|
|
@@ -41,7 +38,7 @@ playwright-cli dblclick e7
|
|
|
41
38
|
playwright-cli fill e5 "user@example.com" --submit
|
|
42
39
|
playwright-cli drag e2 e8
|
|
43
40
|
# drop files or data onto an element (from outside the page)
|
|
44
|
-
playwright-cli drop e4 --path
|
|
41
|
+
playwright-cli drop e4 --path=/workspace/image.png
|
|
45
42
|
playwright-cli drop e4 --data="text/plain=hello world"
|
|
46
43
|
playwright-cli hover e4
|
|
47
44
|
playwright-cli select e9 "option-value"
|
|
@@ -97,65 +94,11 @@ playwright-cli mousewheel 0 100
|
|
|
97
94
|
### Save as
|
|
98
95
|
|
|
99
96
|
```bash
|
|
100
|
-
playwright-cli screenshot
|
|
101
|
-
playwright-cli screenshot e5
|
|
102
97
|
playwright-cli screenshot --filename=/workspace/page.png
|
|
103
|
-
playwright-cli screenshot --
|
|
98
|
+
playwright-cli screenshot e5 --filename=/workspace/page.png
|
|
104
99
|
playwright-cli pdf --filename=/workspace/page.pdf
|
|
105
100
|
```
|
|
106
101
|
|
|
107
|
-
### Tabs
|
|
108
|
-
|
|
109
|
-
```bash
|
|
110
|
-
playwright-cli tab-list
|
|
111
|
-
playwright-cli tab-new
|
|
112
|
-
playwright-cli tab-new https://example.com/page
|
|
113
|
-
playwright-cli tab-close
|
|
114
|
-
playwright-cli tab-close 2
|
|
115
|
-
playwright-cli tab-select 0
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
### Storage
|
|
119
|
-
|
|
120
|
-
```bash
|
|
121
|
-
playwright-cli state-save
|
|
122
|
-
playwright-cli state-save auth.json
|
|
123
|
-
playwright-cli state-load auth.json
|
|
124
|
-
|
|
125
|
-
# Cookies
|
|
126
|
-
playwright-cli cookie-list
|
|
127
|
-
playwright-cli cookie-list --domain=example.com
|
|
128
|
-
playwright-cli cookie-get session_id
|
|
129
|
-
playwright-cli cookie-set session_id abc123
|
|
130
|
-
playwright-cli cookie-set session_id abc123 --domain=example.com --httpOnly --secure
|
|
131
|
-
playwright-cli cookie-delete session_id
|
|
132
|
-
playwright-cli cookie-clear
|
|
133
|
-
|
|
134
|
-
# LocalStorage
|
|
135
|
-
playwright-cli localstorage-list
|
|
136
|
-
playwright-cli localstorage-get theme
|
|
137
|
-
playwright-cli localstorage-set theme dark
|
|
138
|
-
playwright-cli localstorage-delete theme
|
|
139
|
-
playwright-cli localstorage-clear
|
|
140
|
-
|
|
141
|
-
# SessionStorage
|
|
142
|
-
playwright-cli sessionstorage-list
|
|
143
|
-
playwright-cli sessionstorage-get step
|
|
144
|
-
playwright-cli sessionstorage-set step 3
|
|
145
|
-
playwright-cli sessionstorage-delete step
|
|
146
|
-
playwright-cli sessionstorage-clear
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
### Network
|
|
150
|
-
|
|
151
|
-
```bash
|
|
152
|
-
playwright-cli route "**/*.jpg" --status=404
|
|
153
|
-
playwright-cli route "https://api.example.com/**" --body='{"mock": true}'
|
|
154
|
-
playwright-cli route-list
|
|
155
|
-
playwright-cli unroute "**/*.jpg"
|
|
156
|
-
playwright-cli unroute
|
|
157
|
-
```
|
|
158
|
-
|
|
159
102
|
### DevTools
|
|
160
103
|
|
|
161
104
|
```bash
|
|
@@ -165,20 +108,6 @@ playwright-cli requests
|
|
|
165
108
|
playwright-cli request 5
|
|
166
109
|
playwright-cli run-code "async page => await page.context().grantPermissions(['geolocation'])"
|
|
167
110
|
playwright-cli run-code --filename=/workspace/script.js
|
|
168
|
-
playwright-cli tracing-start
|
|
169
|
-
playwright-cli tracing-stop
|
|
170
|
-
|
|
171
|
-
# record user actions in the browser, print them as Playwright code on stop
|
|
172
|
-
playwright-cli recording-start
|
|
173
|
-
playwright-cli recording-stop
|
|
174
|
-
|
|
175
|
-
playwright-cli video-start video.webm
|
|
176
|
-
playwright-cli video-chapter "Chapter Title" --description="Details" --duration=2000
|
|
177
|
-
playwright-cli video-stop
|
|
178
|
-
|
|
179
|
-
# annotate each subsequent action (click, type, ...) with a callout naming the action and highlighting the target
|
|
180
|
-
playwright-cli video-show-actions --duration=600 --position=top-right
|
|
181
|
-
playwright-cli video-hide-actions
|
|
182
111
|
|
|
183
112
|
# launch the dashboard for UI review / design feedback — user annotates the page, you receive the annotated screenshot, snapshot, and notes
|
|
184
113
|
playwright-cli show --annotate
|
|
@@ -194,89 +123,9 @@ playwright-cli highlight e5 --hide
|
|
|
194
123
|
playwright-cli highlight --hide
|
|
195
124
|
```
|
|
196
125
|
|
|
197
|
-
## Raw output
|
|
198
|
-
|
|
199
|
-
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.
|
|
200
|
-
|
|
201
|
-
```bash
|
|
202
|
-
playwright-cli --raw eval "JSON.stringify(performance.timing)" | jq '.loadEventEnd - .navigationStart'
|
|
203
|
-
playwright-cli --raw eval "JSON.stringify([...document.querySelectorAll('a')].map(a => a.href))" > links.json
|
|
204
|
-
playwright-cli --raw snapshot > before.yml
|
|
205
|
-
playwright-cli click e5
|
|
206
|
-
playwright-cli --raw snapshot > after.yml
|
|
207
|
-
diff before.yml after.yml
|
|
208
|
-
TOKEN=$(playwright-cli --raw cookie-get session_id)
|
|
209
|
-
playwright-cli --raw localstorage-get theme
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
For structured output wrapping every reply as JSON, pass --json
|
|
213
|
-
```bash
|
|
214
|
-
playwright-cli list --json
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
## Open parameters
|
|
218
|
-
```bash
|
|
219
|
-
# Use specific browser when creating session
|
|
220
|
-
playwright-cli open --browser=chrome
|
|
221
|
-
playwright-cli open --browser=firefox
|
|
222
|
-
playwright-cli open --browser=webkit
|
|
223
|
-
playwright-cli open --browser=msedge
|
|
224
|
-
|
|
225
|
-
# Emulate a generic mobile device (Pixel 10 for Chromium, iPhone 17 for WebKit).
|
|
226
|
-
# Prefer this when a mobile layout is acceptable: mobile pages are usually
|
|
227
|
-
# lighter, so snapshots are smaller and cheaper.
|
|
228
|
-
playwright-cli open --mobile
|
|
229
|
-
playwright-cli open --device="iPhone 15"
|
|
230
|
-
|
|
231
|
-
# Open in headed mode
|
|
232
|
-
playwright-cli open --headed
|
|
233
|
-
|
|
234
|
-
# Use persistent profile (by default profile is in-memory)
|
|
235
|
-
playwright-cli open --persistent
|
|
236
|
-
# Use persistent profile with custom directory
|
|
237
|
-
playwright-cli open --profile=/path/to/profile
|
|
238
|
-
|
|
239
|
-
# Connect to browser via Playwright Extension
|
|
240
|
-
playwright-cli attach --extension=chrome
|
|
241
|
-
|
|
242
|
-
# Connect to a running Chrome or Edge by channel name
|
|
243
|
-
playwright-cli attach --cdp=chrome
|
|
244
|
-
playwright-cli attach --cdp=msedge
|
|
245
|
-
|
|
246
|
-
# Connect to a running browser via CDP endpoint
|
|
247
|
-
playwright-cli attach --cdp=http://localhost:9222
|
|
248
|
-
|
|
249
|
-
# Start with config file
|
|
250
|
-
playwright-cli open --config=my-config.json
|
|
251
|
-
|
|
252
|
-
# Close the browser
|
|
253
|
-
playwright-cli close
|
|
254
|
-
# Detach from an attached browser (leaves the external browser running)
|
|
255
|
-
playwright-cli -s=msedge detach
|
|
256
|
-
# Delete user data for the default session
|
|
257
|
-
playwright-cli delete-data
|
|
258
|
-
```
|
|
259
|
-
|
|
260
126
|
## Snapshots
|
|
261
127
|
|
|
262
|
-
After each command, playwright-cli provides a snapshot of the current browser state.
|
|
263
|
-
|
|
264
128
|
```bash
|
|
265
|
-
> playwright-cli goto https://example.com
|
|
266
|
-
### Page
|
|
267
|
-
- Page URL: https://example.com/
|
|
268
|
-
- Page Title: Example Domain
|
|
269
|
-
### Snapshot
|
|
270
|
-
[Snapshot](.playwright-cli/page-2026-02-14T19-22-42-679Z.yml)
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
You can also take a snapshot on demand using `playwright-cli snapshot` command. All the options below can be combined as needed.
|
|
274
|
-
|
|
275
|
-
```bash
|
|
276
|
-
# default - save to a file with timestamp-based name
|
|
277
|
-
playwright-cli snapshot
|
|
278
|
-
|
|
279
|
-
# save to file, use when snapshot is a part of the workflow result
|
|
280
129
|
playwright-cli snapshot --filename=/workspace/after-click.yaml
|
|
281
130
|
|
|
282
131
|
# snapshot an element instead of the whole page
|
|
@@ -320,30 +169,11 @@ playwright-cli click "getByRole('button', { name: 'Submit' })"
|
|
|
320
169
|
playwright-cli click "getByTestId('submit-button')"
|
|
321
170
|
```
|
|
322
171
|
|
|
323
|
-
## Browser Sessions
|
|
324
|
-
|
|
325
|
-
```bash
|
|
326
|
-
# create new browser session named "mysession" with persistent profile
|
|
327
|
-
playwright-cli -s=mysession open example.com --persistent
|
|
328
|
-
# same with manually specified profile directory (use when requested explicitly)
|
|
329
|
-
playwright-cli -s=mysession open example.com --profile=/path/to/profile
|
|
330
|
-
playwright-cli -s=mysession click e6
|
|
331
|
-
playwright-cli -s=mysession close # stop a named browser
|
|
332
|
-
playwright-cli -s=mysession delete-data # delete user data for persistent session
|
|
333
|
-
|
|
334
|
-
playwright-cli list
|
|
335
|
-
# Close all browsers
|
|
336
|
-
playwright-cli close-all
|
|
337
|
-
# Forcefully kill all browser processes
|
|
338
|
-
playwright-cli kill-all
|
|
339
|
-
```
|
|
340
|
-
|
|
341
172
|
## Example: Form submission
|
|
342
173
|
|
|
343
174
|
```bash
|
|
344
175
|
playwright-cli open https://example.com/form
|
|
345
176
|
playwright-cli snapshot
|
|
346
|
-
|
|
347
177
|
playwright-cli fill e1 "user@example.com"
|
|
348
178
|
playwright-cli fill e2 "password123"
|
|
349
179
|
playwright-cli click e3
|
|
@@ -373,15 +203,6 @@ playwright-cli requests
|
|
|
373
203
|
playwright-cli close
|
|
374
204
|
```
|
|
375
205
|
|
|
376
|
-
```bash
|
|
377
|
-
playwright-cli open https://example.com
|
|
378
|
-
playwright-cli tracing-start
|
|
379
|
-
playwright-cli click e4
|
|
380
|
-
playwright-cli fill e7 "test"
|
|
381
|
-
playwright-cli tracing-stop
|
|
382
|
-
playwright-cli close
|
|
383
|
-
```
|
|
384
|
-
|
|
385
206
|
## Example: Interactive session
|
|
386
207
|
|
|
387
208
|
Ask 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":
|
|
@@ -390,15 +211,3 @@ Ask the user for UI review or design feedback. The user draws boxes on the live
|
|
|
390
211
|
playwright-cli open https://example.com
|
|
391
212
|
playwright-cli show --annotate
|
|
392
213
|
```
|
|
393
|
-
|
|
394
|
-
## Specific tasks
|
|
395
|
-
|
|
396
|
-
* **Running and Debugging Playwright tests** [references/playwright-tests.md](references/playwright-tests.md)
|
|
397
|
-
* **Request mocking** [references/request-mocking.md](references/request-mocking.md)
|
|
398
|
-
* **Running Playwright code** [references/running-code.md](references/running-code.md)
|
|
399
|
-
* **Browser session management** [references/session-management.md](references/session-management.md)
|
|
400
|
-
* **Storage state (cookies, localStorage)** [references/storage-state.md](references/storage-state.md)
|
|
401
|
-
* **Test generation (plan / generate / heal)** [references/test-generation.md](references/test-generation.md)
|
|
402
|
-
* **Tracing** [references/tracing.md](references/tracing.md)
|
|
403
|
-
* **Video recording** [references/video-recording.md](references/video-recording.md)
|
|
404
|
-
* **Inspecting element attributes** [references/element-attributes.md](references/element-attributes.md)
|