Skip to content

Commit 4fafccc

Browse files
committed
chore: update skill files
1 parent 3ed6f75 commit 4fafccc

4 files changed

Lines changed: 118 additions & 93 deletions

File tree

‎scripts/update.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ async function main() {
2323

2424
// 3. Move generated skills into the existing skills folder
2525
console.log('\n=== Updating skills folder ===\n');
26-
const generatedSkillsDir = path.join(rootDir, '.claude', 'skills', 'playwright');
26+
const generatedSkillsDir = path.join(rootDir, '.claude', 'skills', 'playwright-cli');
2727
const targetSkillsDir = path.join(skillsDir, 'playwright-cli');
2828

2929
try {

‎skills/playwright-cli/SKILL.md‎

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,29 @@ allowed-tools: Bash(playwright-cli:*)
99
## Quick start
1010

1111
```bash
12-
playwright-cli open https://playwright.dev
12+
# open new browser
13+
playwright-cli open
14+
# navigate to a page
15+
playwright-cli goto https://playwright.dev
16+
# interact with the page using refs from the snapshot
1317
playwright-cli click e15
1418
playwright-cli type "page.click"
1519
playwright-cli press Enter
20+
# take a screenshot
21+
playwright-cli screenshot
22+
# close the browser
23+
playwright-cli close
1624
```
1725

18-
## Core workflow
19-
20-
1. Navigate: `playwright-cli open https://example.com`
21-
2. Interact using refs from the snapshot
22-
3. Re-snapshot after significant changes
23-
2426
## Commands
2527

2628
### Core
2729

2830
```bash
31+
playwright-cli open
32+
# open and navigate right away
2933
playwright-cli open https://example.com/
30-
playwright-cli close
34+
playwright-cli goto https://playwright.dev
3135
playwright-cli type "search query"
3236
playwright-cli click e3
3337
playwright-cli dblclick e7
@@ -46,6 +50,7 @@ playwright-cli dialog-accept
4650
playwright-cli dialog-accept "confirmation text"
4751
playwright-cli dialog-dismiss
4852
playwright-cli resize 1920 1080
53+
playwright-cli close
4954
```
5055
5156
### Navigation
@@ -167,26 +172,36 @@ playwright-cli open --browser=msedge
167172
# Connect to browser via extension
168173
playwright-cli open --extension
169174

170-
# Configure the session
171-
playwright-cli config --config my-config.json
172-
playwright-cli config --headed --in-memory --browser=firefox
173-
# Configure named session
174-
playwright-cli --session=mysession config my-config.json
175-
# Start with configured session
175+
# Use persistent profile (by default profile is in-memory)
176+
playwright-cli open --persistent
177+
# Use persistent profile with custom directory
178+
playwright-cli open --profile=/path/to/profile
179+
180+
# Start with config file
176181
playwright-cli open --config=my-config.json
182+
183+
# Close the browser
184+
playwright-cli close
185+
# Delete user data for the default session
186+
playwright-cli delete-data
177187
```
178188
179-
### Sessions
189+
### Browser Sessions
180190
181191
```bash
182-
playwright-cli --session=mysession open example.com
183-
playwright-cli --session=mysession click e6
184-
playwright-cli session-list
185-
playwright-cli session-stop mysession
186-
playwright-cli session-restart mysession
187-
playwright-cli session-stop-all
188-
playwright-cli session-delete
189-
playwright-cli session-delete mysession
192+
# create new browser session named "mysession" with persistent profile
193+
playwright-cli -s=mysession open example.com --persistent
194+
# same with manually specified profile directory (use when requested explicitly)
195+
playwright-cli -s=mysession open example.com --profile=/path/to/profile
196+
playwright-cli -s=mysession click e6
197+
playwright-cli -s=mysession close # stop a named browser
198+
playwright-cli -s=mysession delete-data # delete user data for persistent session
199+
200+
playwright-cli list
201+
# Close all browsers
202+
playwright-cli close-all
203+
# Forcefully kill all browser processes
204+
playwright-cli kill-all
190205
```
191206
192207
## Example: Form submission
@@ -199,6 +214,7 @@ playwright-cli fill e1 "user@example.com"
199214
playwright-cli fill e2 "password123"
200215
playwright-cli click e3
201216
playwright-cli snapshot
217+
playwright-cli close
202218
```
203219
204220
## Example: Multi-tab workflow
@@ -209,6 +225,7 @@ playwright-cli tab-new https://example.com/other
209225
playwright-cli tab-list
210226
playwright-cli tab-select 0
211227
playwright-cli snapshot
228+
playwright-cli close
212229
```
213230
214231
## Example: Debugging with DevTools
@@ -219,6 +236,7 @@ playwright-cli click e4
219236
playwright-cli fill e7 "test"
220237
playwright-cli console
221238
playwright-cli network
239+
playwright-cli close
222240
```
223241
224242
```bash
@@ -227,13 +245,14 @@ playwright-cli tracing-start
227245
playwright-cli click e4
228246
playwright-cli fill e7 "test"
229247
playwright-cli tracing-stop
248+
playwright-cli close
230249
```
231250
232251
## Specific tasks
233252
234253
* **Request mocking** [references/request-mocking.md](references/request-mocking.md)
235254
* **Running Playwright code** [references/running-code.md](references/running-code.md)
236-
* **Session management** [references/session-management.md](references/session-management.md)
255+
* **Browser session management** [references/session-management.md](references/session-management.md)
237256
* **Storage state (cookies, localStorage)** [references/storage-state.md](references/storage-state.md)
238257
* **Test generation** [references/test-generation.md](references/test-generation.md)
239258
* **Tracing** [references/tracing.md](references/tracing.md)
Lines changed: 73 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,57 @@
1-
# Session Management
1+
# Browser Session Management
22

33
Run multiple isolated browser sessions concurrently with state persistence.
44

5-
## Named Sessions
5+
## Named Browser Sessions
66

7-
Use `--session` flag to isolate browser contexts:
7+
Use `-b` flag to isolate browser contexts:
88

99
```bash
10-
# Session 1: Authentication flow
11-
playwright-cli --session=auth open https://app.example.com/login
10+
# Browser 1: Authentication flow
11+
playwright-cli -s=auth open https://app.example.com/login
1212

13-
# Session 2: Public browsing (separate cookies, storage)
14-
playwright-cli --session=public open https://example.com
13+
# Browser 2: Public browsing (separate cookies, storage)
14+
playwright-cli -s=public open https://example.com
1515

16-
# Commands are isolated by session
17-
playwright-cli --session=auth fill e1 "user@example.com"
18-
playwright-cli --session=public snapshot
16+
# Commands are isolated by browser session
17+
playwright-cli -s=auth fill e1 "user@example.com"
18+
playwright-cli -s=public snapshot
1919
```
2020

21-
## Session Isolation Properties
21+
## Browser Session Isolation Properties
2222

23-
Each session has independent:
23+
Each browser session has independent:
2424
- Cookies
2525
- LocalStorage / SessionStorage
2626
- IndexedDB
2727
- Cache
2828
- Browsing history
2929
- Open tabs
3030

31-
## Session Commands
31+
## Browser Session Commands
3232

3333
```bash
34-
# List all sessions
35-
playwright-cli session-list
34+
# List all browser sessions
35+
playwright-cli list
3636

37-
# Stop a specific session
38-
playwright-cli session-stop mysession
37+
# Stop a browser session (close the browser)
38+
playwright-cli close # stop the default browser
39+
playwright-cli -s=mysession close # stop a named browser
3940

40-
# Stop all sessions
41-
playwright-cli session-stop-all
41+
# Stop all browser sessions
42+
playwright-cli close-all
4243

43-
# Restart a session (useful after version updates)
44-
playwright-cli session-restart mysession
44+
# Forcefully kill all daemon processes (for stale/zombie processes)
45+
playwright-cli kill-all
4546

46-
# Delete session data (cookies, storage, etc.)
47-
playwright-cli session-delete mysession
47+
# Delete browser session user data (profile directory)
48+
playwright-cli delete-data # delete default browser data
49+
playwright-cli -s=mysession delete-data # delete named browser data
4850
```
4951

5052
## Environment Variable
5153

52-
Set a default session name via environment variable:
54+
Set a default browser session name via environment variable:
5355

5456
```bash
5557
export PLAYWRIGHT_CLI_SESSION="mysession"
@@ -64,100 +66,104 @@ playwright-cli open example.com # Uses "mysession" automatically
6466
#!/bin/bash
6567
# Scrape multiple sites concurrently
6668

67-
# Start all sessions
68-
playwright-cli --session=site1 open https://site1.com &
69-
playwright-cli --session=site2 open https://site2.com &
70-
playwright-cli --session=site3 open https://site3.com &
69+
# Start all browsers
70+
playwright-cli -s=site1 open https://site1.com &
71+
playwright-cli -s=site2 open https://site2.com &
72+
playwright-cli -s=site3 open https://site3.com &
7173
wait
7274

7375
# Take snapshots from each
74-
playwright-cli --session=site1 snapshot
75-
playwright-cli --session=site2 snapshot
76-
playwright-cli --session=site3 snapshot
76+
playwright-cli -s=site1 snapshot
77+
playwright-cli -s=site2 snapshot
78+
playwright-cli -s=site3 snapshot
7779

7880
# Cleanup
79-
playwright-cli --session=site1 close
80-
playwright-cli --session=site2 close
81-
playwright-cli --session=site3 close
81+
playwright-cli close-all
8282
```
8383

8484
### A/B Testing Sessions
8585

8686
```bash
8787
# Test different user experiences
88-
playwright-cli --session=variant-a open "https://app.com?variant=a"
89-
playwright-cli --session=variant-b open "https://app.com?variant=b"
88+
playwright-cli -s=variant-a open "https://app.com?variant=a"
89+
playwright-cli -s=variant-b open "https://app.com?variant=b"
9090

9191
# Compare
92-
playwright-cli --session=variant-a screenshot
93-
playwright-cli --session=variant-b screenshot
92+
playwright-cli -s=variant-a screenshot
93+
playwright-cli -s=variant-b screenshot
9494
```
9595

96-
### Testing without persistent profile
96+
### Persistent Profile
9797

98-
Use `--in-memory` flag to keep the browser profile in memory only:
98+
By default, browser profile is kept in memory only. Use `--persistent` flag on `open` to persist the browser profile to disk:
9999

100100
```bash
101-
# Session data won't persist to disk
102-
playwright-cli --in-memory open https://example.com
101+
# Use persistent profile (auto-generated location)
102+
playwright-cli open https://example.com --persistent
103+
104+
# Use persistent profile with custom directory
105+
playwright-cli open https://example.com --profile=/path/to/profile
103106
```
104107

105-
## Default Session
108+
## Default Browser Session
106109

107-
When `--session` is omitted, commands use the default session:
110+
When `-s` is omitted, commands use the default browser session:
108111

109112
```bash
110-
# These use the same default session
113+
# These use the same default browser session
111114
playwright-cli open https://example.com
112115
playwright-cli snapshot
113-
playwright-cli close # Closes default session
116+
playwright-cli close # Stops default browser
114117
```
115118

116-
## Session Configuration
119+
## Browser Session Configuration
117120

118-
Configure a session with specific settings:
121+
Configure a browser session with specific settings when opening:
119122

120123
```bash
121-
# Configure session with config file
122-
playwright-cli --session=mysession config --config=playwright-cli.json
124+
# Open with config file
125+
playwright-cli open https://example.com --config=.playwright/my-cli.json
123126

124-
# Configure session with specific browser
125-
playwright-cli --session=mysession config --browser=firefox
127+
# Open with specific browser
128+
playwright-cli open https://example.com --browser=firefox
126129

127-
# Configure session in headed mode
128-
playwright-cli --session=mysession config --headed
130+
# Open in headed mode
131+
playwright-cli open https://example.com --headed
129132

130-
# Restart session to apply changes
131-
playwright-cli session-restart mysession
133+
# Open with persistent profile
134+
playwright-cli open https://example.com --persistent
132135
```
133136

134137
## Best Practices
135138

136-
### 1. Name Sessions Semantically
139+
### 1. Name Browser Sessions Semantically
137140

138141
```bash
139142
# GOOD: Clear purpose
140-
playwright-cli --session=github-auth open https://github.com
141-
playwright-cli --session=docs-scrape open https://docs.example.com
143+
playwright-cli -s=github-auth open https://github.com
144+
playwright-cli -s=docs-scrape open https://docs.example.com
142145

143146
# AVOID: Generic names
144-
playwright-cli --session=s1 open https://github.com
147+
playwright-cli -s=s1 open https://github.com
145148
```
146149

147150
### 2. Always Clean Up
148151

149152
```bash
150-
# Stop sessions when done
151-
playwright-cli session-stop auth
152-
playwright-cli session-stop scrape
153+
# Stop browsers when done
154+
playwright-cli -s=auth close
155+
playwright-cli -s=scrape close
153156

154157
# Or stop all at once
155-
playwright-cli session-stop-all
158+
playwright-cli close-all
159+
160+
# If browsers become unresponsive or zombie processes remain
161+
playwright-cli kill-all
156162
```
157163

158-
### 3. Delete Stale Session Data
164+
### 3. Delete Stale Browser Data
159165

160166
```bash
161-
# Remove old session data to free disk space
162-
playwright-cli session-delete oldsession
167+
# Remove old browser data to free disk space
168+
playwright-cli -s=oldsession delete-data
163169
```

‎skills/playwright-cli/references/storage-state.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,4 +272,4 @@ playwright-cli open https://example.com
272272
- Add `*.auth-state.json` to `.gitignore`
273273
- Delete state files after automation completes
274274
- Use environment variables for sensitive data
275-
- Consider using `--in-memory` mode for sensitive operations
275+
- By default, sessions run in-memory mode which is safer for sensitive operations

0 commit comments

Comments
 (0)