patchright-cli 0.5.0__tar.gz → 0.7.0__tar.gz

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.
Files changed (57) hide show
  1. {patchright_cli-0.5.0 → patchright_cli-0.7.0}/.claude-plugin/marketplace.json +1 -1
  2. {patchright_cli-0.5.0 → patchright_cli-0.7.0}/.gitignore +3 -0
  3. {patchright_cli-0.5.0 → patchright_cli-0.7.0}/CLAUDE.md +2 -2
  4. patchright_cli-0.7.0/GLOSSARY.md +58 -0
  5. {patchright_cli-0.5.0 → patchright_cli-0.7.0}/PKG-INFO +49 -64
  6. {patchright_cli-0.5.0 → patchright_cli-0.7.0}/README.md +47 -62
  7. patchright_cli-0.7.0/docs/installation.md +146 -0
  8. {patchright_cli-0.5.0 → patchright_cli-0.7.0}/pyproject.toml +1 -1
  9. {patchright_cli-0.5.0 → patchright_cli-0.7.0}/skills/patchright-cli/SKILL.md +192 -31
  10. patchright_cli-0.7.0/skills/patchright-cli/references/session-management.md +172 -0
  11. {patchright_cli-0.5.0 → patchright_cli-0.7.0}/skills/patchright-cli/references/snapshot-refs.md +56 -0
  12. {patchright_cli-0.5.0 → patchright_cli-0.7.0}/skills/patchright-cli/references/video-recording.md +31 -0
  13. {patchright_cli-0.5.0 → patchright_cli-0.7.0}/src/patchright_cli/__init__.py +1 -1
  14. {patchright_cli-0.5.0 → patchright_cli-0.7.0}/src/patchright_cli/cli.py +315 -22
  15. patchright_cli-0.7.0/src/patchright_cli/daemon.py +3148 -0
  16. patchright_cli-0.7.0/src/patchright_cli/dashboard.py +443 -0
  17. patchright_cli-0.7.0/src/patchright_cli/ref_registry.py +316 -0
  18. {patchright_cli-0.5.0 → patchright_cli-0.7.0}/src/patchright_cli/snapshot.py +1 -1
  19. patchright_cli-0.7.0/tests/test_annotate.py +357 -0
  20. patchright_cli-0.7.0/tests/test_attach.py +455 -0
  21. patchright_cli-0.7.0/tests/test_cli_config.py +630 -0
  22. patchright_cli-0.7.0/tests/test_daemon_handlers.py +1207 -0
  23. {patchright_cli-0.5.0 → patchright_cli-0.7.0}/tests/test_e2e.py +94 -0
  24. patchright_cli-0.7.0/tests/test_packaging.py +39 -0
  25. patchright_cli-0.7.0/tests/test_profiles.py +430 -0
  26. patchright_cli-0.7.0/tests/test_ref_registry.py +522 -0
  27. patchright_cli-0.7.0/tests/test_tabs.py +401 -0
  28. {patchright_cli-0.5.0 → patchright_cli-0.7.0}/uv.lock +1 -1
  29. patchright_cli-0.5.0/docs/installation.md +0 -177
  30. patchright_cli-0.5.0/docs/superpowers/plans/2026-04-14-cdp-attach.md +0 -297
  31. patchright_cli-0.5.0/docs/superpowers/plans/2026-04-14-cli-enhancements.md +0 -529
  32. patchright_cli-0.5.0/docs/superpowers/plans/2026-04-14-codegen.md +0 -234
  33. patchright_cli-0.5.0/docs/superpowers/plans/2026-04-14-context-config-and-permissions.md +0 -411
  34. patchright_cli-0.5.0/docs/superpowers/plans/2026-04-14-show-dashboard.md +0 -337
  35. patchright_cli-0.5.0/skills/patchright-cli/references/session-management.md +0 -106
  36. patchright_cli-0.5.0/src/patchright_cli/daemon.py +0 -1718
  37. patchright_cli-0.5.0/src/patchright_cli/dashboard.py +0 -135
  38. patchright_cli-0.5.0/src/patchright_cli/ref_registry.py +0 -106
  39. patchright_cli-0.5.0/tests/test_cli_config.py +0 -203
  40. patchright_cli-0.5.0/tests/test_daemon_handlers.py +0 -306
  41. patchright_cli-0.5.0/tests/test_ref_registry.py +0 -137
  42. {patchright_cli-0.5.0 → patchright_cli-0.7.0}/.claude-plugin/skills/browser-automation.json +0 -0
  43. {patchright_cli-0.5.0 → patchright_cli-0.7.0}/.github/workflows/ci.yml +0 -0
  44. {patchright_cli-0.5.0 → patchright_cli-0.7.0}/.github/workflows/publish.yml +0 -0
  45. {patchright_cli-0.5.0 → patchright_cli-0.7.0}/.pre-commit-config.yaml +0 -0
  46. {patchright_cli-0.5.0 → patchright_cli-0.7.0}/CONTRIBUTING.md +0 -0
  47. {patchright_cli-0.5.0 → patchright_cli-0.7.0}/LICENSE +0 -0
  48. {patchright_cli-0.5.0 → patchright_cli-0.7.0}/Makefile +0 -0
  49. {patchright_cli-0.5.0 → patchright_cli-0.7.0}/patchright-cli +0 -0
  50. {patchright_cli-0.5.0 → patchright_cli-0.7.0}/patchright-cli.cmd +0 -0
  51. {patchright_cli-0.5.0 → patchright_cli-0.7.0}/skills/patchright-cli/references/request-mocking.md +0 -0
  52. {patchright_cli-0.5.0 → patchright_cli-0.7.0}/skills/patchright-cli/references/running-code.md +0 -0
  53. {patchright_cli-0.5.0 → patchright_cli-0.7.0}/skills/patchright-cli/references/storage-state.md +0 -0
  54. {patchright_cli-0.5.0 → patchright_cli-0.7.0}/skills/patchright-cli/references/tracing.md +0 -0
  55. {patchright_cli-0.5.0 → patchright_cli-0.7.0}/src/patchright_cli/__main__.py +0 -0
  56. {patchright_cli-0.5.0 → patchright_cli-0.7.0}/tests/__init__.py +0 -0
  57. {patchright_cli-0.5.0 → patchright_cli-0.7.0}/tests/fixture.html +0 -0
@@ -5,7 +5,7 @@
5
5
  },
6
6
  "metadata": {
7
7
  "description": "Anti-detect browser automation CLI & Skills for AI agents, powered by Patchright",
8
- "version": "0.5.0"
8
+ "version": "0.7.0"
9
9
  },
10
10
  "plugins": [
11
11
  {
@@ -6,4 +6,7 @@ __pycache__/
6
6
  dist/
7
7
  build/
8
8
  docs/reddit-post.md
9
+ docs/superpowers/
9
10
  .worktrees/
11
+ .claude/settings.local.json
12
+ =*
@@ -57,10 +57,10 @@ CLI (cli.py) --TCP:9321--> Daemon (daemon.py) --Patchright--> Chrome
57
57
 
58
58
  - Always uses persistent browser context (`launch_persistent_context`) with real Chrome (`channel="chrome"`), not Chromium
59
59
  - Headed by default (headless is more detectable)
60
- - Default daemon port: 9321, profiles stored at `~/.patchright-cli/profiles/<session-name>`
60
+ - Default daemon port: 9321, profiles stored at `~/.patchright-cli/profiles/<profile-name>`; a session's profile defaults to its session name (`--profile=<name>` overrides, a value with `/` or `\` is a directory). One session per profile at a time
61
61
  - CLI-daemon protocol: length-prefixed (4-byte big-endian `!I`) JSON over TCP
62
62
  - CLI parses argv manually in `main()` — click is only used for `click.echo()`, not subcommands. New commands must be added to both `COMMANDS_HELP` dict and the `handle_command()` if/elif chain in daemon.py
63
- - Version must be updated in both `pyproject.toml` and `src/patchright_cli/__init__.py` (then run `uv lock` to sync the lock file)
63
+ - Version must be updated in `pyproject.toml`, `src/patchright_cli/__init__.py` and `.claude-plugin/marketplace.json` (then run `uv lock` to sync the lock file; `tests/test_packaging.py` checks they match)
64
64
  - `python -m patchright_cli` works via `__main__.py`
65
65
  - Uses hatchling as build backend, ruff for linting (line-length=120, target py310)
66
66
  - Ruff rules: E, F, I, W, UP, B, SIM (ignores E501, SIM105, E402)
@@ -0,0 +1,58 @@
1
+ # patchright-cli
2
+
3
+ An anti-detect browser automation CLI: callers drive real Chrome through short commands sent to a long-running daemon.
4
+
5
+ ## Sessions and browsers
6
+
7
+ **Session**:
8
+ A named handle on one browser context that callers drive with commands; selected with `-s`.
9
+ _Avoid_: Browser, instance, profile
10
+
11
+ **Default Session**:
12
+ The Session used when no `-s` is given.
13
+
14
+ **Launched Session**:
15
+ A Session whose Chrome patchright-cli started itself and therefore owns outright.
16
+
17
+ **Profile**:
18
+ A named, persistent store of browser state — cookies, storage, logins, history — that a Launched Session runs on; at most one Session uses a Profile at a time. Unless told otherwise, a Session's Profile is named after the Session.
19
+ _Avoid_: User data dir, profile directory, persistent context
20
+
21
+ **Attached Session**:
22
+ A Session connected to a Chrome that something else started, reached over CDP.
23
+ _Avoid_: Connected session, remote session
24
+
25
+ **Host**:
26
+ Whatever started and owns the Chrome an Attached Session connects to — a person, a script, or a product such as a workspace manager.
27
+ _Avoid_: External browser, owner
28
+
29
+ **Host Context**:
30
+ The Host's own browser context, carrying its profile's cookies, storage and logins; at most one Session may use a given Host Context.
31
+ _Avoid_: Default context, existing context, persistent context
32
+
33
+ **Isolated Context**:
34
+ A fresh browser context an Attached Session creates inside the Host's Chrome, sharing none of the Host's state.
35
+ _Avoid_: Incognito context
36
+
37
+ ## Tabs and pages
38
+
39
+ **Page**:
40
+ One browser tab as Chrome sees it.
41
+ _Avoid_: Tab (except in the playwright-cli-compatible `tab-*` command names, which act on Pages)
42
+
43
+ **Tab**:
44
+ A named workspace inside a Session — its own Page, element refs and navigation history — selected with `--tab`.
45
+ _Avoid_: Lane, worker
46
+
47
+ **Default Tab**:
48
+ The Tab used when no `--tab` is given; it follows whichever Page is currently selected rather than owning one.
49
+
50
+ ## Ending a Session
51
+
52
+ **Close**:
53
+ Ending a Session by destroying what it owns: its Tabs' Pages and, for a context it owns, the context itself.
54
+ _Avoid_: Quit, kill (except `kill-all`)
55
+
56
+ **Detach**:
57
+ Letting go of an Attached Session while leaving the Host's Chrome, and anything the Host owns, untouched.
58
+ _Avoid_: Disconnect, release
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: patchright-cli
3
- Version: 0.5.0
3
+ Version: 0.7.0
4
4
  Summary: Anti-detect browser automation CLI using Patchright (undetected Playwright fork)
5
5
  Project-URL: Homepage, https://github.com/AhaiMk01/patchright-cli
6
6
  Project-URL: Repository, https://github.com/AhaiMk01/patchright-cli
@@ -149,7 +149,7 @@ graph LR
149
149
  |-----------|------|
150
150
  | **Daemon** (`daemon.py`) | Long-running process managing browser sessions via Patchright. Auto-starts on first `open`. |
151
151
  | **CLI** (`cli.py`) | Thin client — connects, sends command, prints result, disconnects. Browser stays open. |
152
- | **Snapshot** (`snapshot.py`) | `TreeWalker`-based DOM scan assigning `data-patchright-ref` attributes for element targeting. |
152
+ | **Snapshot** (`snapshot.py`) | Playwright `aria_snapshot()` accessibility tree, annotated with sequential `[ref=eN]` handles for element targeting. |
153
153
 
154
154
  ---
155
155
 
@@ -159,9 +159,12 @@ graph LR
159
159
  ### Core
160
160
  ```bash
161
161
  patchright-cli open [url] # Launch browser
162
- patchright-cli open --persistent # With persistent profile
162
+ patchright-cli open --profile=work # Named profile any session can use (logins persist)
163
163
  patchright-cli open --headless # Run headless
164
- patchright-cli open --profile=<path> # Custom profile directory
164
+ patchright-cli open --profile=./dir # A value with / or \ is a profile directory
165
+ patchright-cli --tab <name> open <url> # Named tab: shared browser, own page/refs
166
+ patchright-cli open --mobile # Emulate a generic mobile device (Pixel 7)
167
+ patchright-cli open --device="Pixel 5" # Emulate a specific Playwright device
165
168
  patchright-cli goto <url> # Navigate
166
169
  patchright-cli click <ref> # Click element
167
170
  patchright-cli click <ref> right # Right-click
@@ -180,8 +183,13 @@ patchright-cli drag <from> <to> # Drag and drop
180
183
  patchright-cli snapshot # Accessibility snapshot
181
184
  patchright-cli snapshot -i # Interactive elements only (recommended)
182
185
  patchright-cli snapshot --depth=3 # Limit depth
186
+ patchright-cli snapshot --selector=CSS # Snapshot a CSS-scoped subtree
183
187
  patchright-cli snapshot <ref> # Snapshot element subtree
184
188
  patchright-cli snapshot --filename=f # Save to custom path
189
+ patchright-cli find "text" # Search snapshot for text
190
+ patchright-cli find --regex "a|b" # Search by regex
191
+ patchright-cli find "text" --all # Include text/paragraph nodes
192
+ patchright-cli find "text" --limit=50 # Cap hits (default 20)
185
193
  patchright-cli eval <expr> # Run JavaScript
186
194
  patchright-cli eval --file=script.js # Run JS from file
187
195
  patchright-cli run-code <code> # Run JS with return value
@@ -190,6 +198,7 @@ patchright-cli screenshot # Page screenshot
190
198
  patchright-cli screenshot --full-page # Full scrollable page
191
199
  patchright-cli screenshot <ref> # Element screenshot
192
200
  patchright-cli screenshot --filename=f # Save to custom path
201
+ patchright-cli screenshot --hires # Capture at device pixel ratio
193
202
  patchright-cli close # Close session
194
203
  ```
195
204
 
@@ -198,6 +207,10 @@ patchright-cli close # Close session
198
207
  patchright-cli go-back
199
208
  patchright-cli go-forward
200
209
  patchright-cli reload
210
+ patchright-cli wait 500 # Wait a fixed number of milliseconds
211
+ patchright-cli wait --url="**/dashboard" # Wait for the URL to match (`*` never crosses a `/`)
212
+ patchright-cli wait-for <ref> # Wait until an element is visible
213
+ patchright-cli wait-for <ref> --state=hidden
201
214
  ```
202
215
 
203
216
  ### Keyboard / Mouse
@@ -285,6 +298,9 @@ patchright-cli tracing-stop # Saves .zip trace file
285
298
  patchright-cli video-start # Start video recording (CDP screencast)
286
299
  patchright-cli video-stop # Stop and save video (requires ffmpeg for .webm)
287
300
  patchright-cli video-stop --filename=recording.webm
301
+ patchright-cli show --annotate # Ask a human to mark up the page, wait for it
302
+ patchright-cli video-show-actions # Annotate each action in the recording
303
+ patchright-cli video-hide-actions # Stop annotating actions
288
304
  patchright-cli pdf --filename=page.pdf
289
305
  ```
290
306
 
@@ -317,13 +333,15 @@ patchright-cli install --skills # Auto-install skills for detected AI age
317
333
 
318
334
  ### Sessions
319
335
  ```bash
320
- patchright-cli -s=mysession open https://example.com --persistent
336
+ patchright-cli -s=mysession open https://example.com
321
337
  patchright-cli -s=mysession click e6
322
338
  patchright-cli -s=mysession close
323
339
  patchright-cli list # List all sessions
324
340
  patchright-cli close-all
325
341
  patchright-cli kill-all
326
- patchright-cli delete-data # Delete persistent profile
342
+ patchright-cli delete-data # Delete the profile named after the session
343
+ patchright-cli profile-list # Profiles, size, and which session uses each
344
+ patchright-cli profile-delete <name> # Delete an idle named profile
327
345
  patchright-cli --port=9322 open # Custom daemon port
328
346
  ```
329
347
 
@@ -331,74 +349,41 @@ patchright-cli --port=9322 open # Custom daemon port
331
349
 
332
350
  ---
333
351
 
334
- ## Snapshots
335
-
336
- After each state-changing command, the CLI outputs page info and a YAML snapshot:
337
-
338
- ```
339
- ### Page
340
- - Page URL: https://example.com/
341
- - Page Title: Example Domain
342
- ### Snapshot
343
- [Snapshot](.patchright-cli/page-1774376207818.yml)
344
- ```
345
-
346
- The snapshot lists interactive elements with refs you can use in commands:
347
-
348
- ```yaml
349
- - ref: e1
350
- role: heading
351
- name: Example Domain
352
- level: 1
353
- - ref: e2
354
- role: link
355
- name: Learn more
356
- url: "https://iana.org/domains/example"
357
- ```
358
-
359
- > [!NOTE]
360
- > Use refs directly: `patchright-cli click e2`, `patchright-cli fill e5 "text"`
361
-
362
- ---
363
-
364
- ## Anti-Detect Features
365
-
366
- > [!CAUTION]
367
- > This tool is for **authorized testing, security research, and legitimate automation** only.
368
-
369
- - :white_check_mark: Real Chrome browser (not Chromium)
370
- - :white_check_mark: Patchright patches `navigator.webdriver` and other detection vectors
371
- - :white_check_mark: Persistent profiles maintain cookies/sessions across runs
372
- - :white_check_mark: No custom user-agent or headers (natural fingerprint)
373
- - :white_check_mark: Headed by default (headless is more detectable)
374
-
375
- ---
376
-
377
352
  ## Agent Integration
378
353
 
379
- Works with any AI coding agent that supports SKILL.md skills:
354
+ Works with Claude Code, Cursor, Gemini CLI, Codex, and [40+ other agents](https://github.com/vercel-labs/skills).
380
355
 
381
- | Agent | Install skill |
382
- |-------|--------------|
383
- | **Claude Code** | `mkdir -p ~/.claude/skills/patchright-cli && curl -sL https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md -o ~/.claude/skills/patchright-cli/SKILL.md` |
384
- | **OpenClaw** | `mkdir -p ~/.openclaw/skills/patchright-cli && curl -sL https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md -o ~/.openclaw/skills/patchright-cli/SKILL.md` |
385
- | **Codex CLI** | `mkdir -p ~/.codex/skills/patchright-cli && curl -sL https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md -o ~/.codex/skills/patchright-cli/SKILL.md` |
386
- | **Gemini CLI** | `mkdir -p ~/.gemini/skills/patchright-cli && curl -sL https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md -o ~/.gemini/skills/patchright-cli/SKILL.md` |
387
- | **OpenCode** | `mkdir -p ~/.opencode/skills/patchright-cli && curl -sL https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md -o ~/.opencode/skills/patchright-cli/SKILL.md` |
388
- | **Cursor** | Copy SKILL.md to `.cursor/skills/patchright-cli/` in your project |
389
- | **Windsurf** | Copy SKILL.md to `.windsurf/skills/patchright-cli/` in your project |
390
- | **Aider** | Copy SKILL.md to `.aider/skills/patchright-cli/` in your project |
356
+ ```bash
357
+ # Install skill for all detected agents (recommended)
358
+ npx skills add AhaiMk01/patchright-cli
359
+ ```
391
360
 
392
- Or auto-install for all detected agents:
361
+ <details>
362
+ <summary><b>Other install methods</b></summary>
393
363
 
394
364
  ```bash
365
+ # Via patchright-cli itself
395
366
  pip install patchright-cli
396
367
  patchright-cli install --skills
368
+
369
+ # Or just tell your agent:
370
+ # "Install patchright-cli skill from https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md"
397
371
  ```
398
372
 
399
- Or just tell your agent:
373
+ </details>
400
374
 
401
- > Install patchright-cli skill from https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md
375
+ ### Skill docs
376
+
377
+ | File | Topic |
378
+ |------|-------|
379
+ | [`SKILL.md`](skills/patchright-cli/SKILL.md) | Main skill — commands, options, patterns |
380
+ | [`snapshot-refs.md`](skills/patchright-cli/references/snapshot-refs.md) | Snapshots, element refs, `-i` flag |
381
+ | [`session-management.md`](skills/patchright-cli/references/session-management.md) | Named sessions, profiles, CDP, dashboard |
382
+ | [`request-mocking.md`](skills/patchright-cli/references/request-mocking.md) | Route mocking, network state |
383
+ | [`storage-state.md`](skills/patchright-cli/references/storage-state.md) | Cookies, localStorage, sessionStorage |
384
+ | [`running-code.md`](skills/patchright-cli/references/running-code.md) | eval, run-code, `--file`, stdin |
385
+ | [`tracing.md`](skills/patchright-cli/references/tracing.md) | Trace recording and debugging |
386
+ | [`video-recording.md`](skills/patchright-cli/references/video-recording.md) | Video, codegen, screenshot, PDF |
402
387
 
403
388
  ---
404
389
 
@@ -116,7 +116,7 @@ graph LR
116
116
  |-----------|------|
117
117
  | **Daemon** (`daemon.py`) | Long-running process managing browser sessions via Patchright. Auto-starts on first `open`. |
118
118
  | **CLI** (`cli.py`) | Thin client — connects, sends command, prints result, disconnects. Browser stays open. |
119
- | **Snapshot** (`snapshot.py`) | `TreeWalker`-based DOM scan assigning `data-patchright-ref` attributes for element targeting. |
119
+ | **Snapshot** (`snapshot.py`) | Playwright `aria_snapshot()` accessibility tree, annotated with sequential `[ref=eN]` handles for element targeting. |
120
120
 
121
121
  ---
122
122
 
@@ -126,9 +126,12 @@ graph LR
126
126
  ### Core
127
127
  ```bash
128
128
  patchright-cli open [url] # Launch browser
129
- patchright-cli open --persistent # With persistent profile
129
+ patchright-cli open --profile=work # Named profile any session can use (logins persist)
130
130
  patchright-cli open --headless # Run headless
131
- patchright-cli open --profile=<path> # Custom profile directory
131
+ patchright-cli open --profile=./dir # A value with / or \ is a profile directory
132
+ patchright-cli --tab <name> open <url> # Named tab: shared browser, own page/refs
133
+ patchright-cli open --mobile # Emulate a generic mobile device (Pixel 7)
134
+ patchright-cli open --device="Pixel 5" # Emulate a specific Playwright device
132
135
  patchright-cli goto <url> # Navigate
133
136
  patchright-cli click <ref> # Click element
134
137
  patchright-cli click <ref> right # Right-click
@@ -147,8 +150,13 @@ patchright-cli drag <from> <to> # Drag and drop
147
150
  patchright-cli snapshot # Accessibility snapshot
148
151
  patchright-cli snapshot -i # Interactive elements only (recommended)
149
152
  patchright-cli snapshot --depth=3 # Limit depth
153
+ patchright-cli snapshot --selector=CSS # Snapshot a CSS-scoped subtree
150
154
  patchright-cli snapshot <ref> # Snapshot element subtree
151
155
  patchright-cli snapshot --filename=f # Save to custom path
156
+ patchright-cli find "text" # Search snapshot for text
157
+ patchright-cli find --regex "a|b" # Search by regex
158
+ patchright-cli find "text" --all # Include text/paragraph nodes
159
+ patchright-cli find "text" --limit=50 # Cap hits (default 20)
152
160
  patchright-cli eval <expr> # Run JavaScript
153
161
  patchright-cli eval --file=script.js # Run JS from file
154
162
  patchright-cli run-code <code> # Run JS with return value
@@ -157,6 +165,7 @@ patchright-cli screenshot # Page screenshot
157
165
  patchright-cli screenshot --full-page # Full scrollable page
158
166
  patchright-cli screenshot <ref> # Element screenshot
159
167
  patchright-cli screenshot --filename=f # Save to custom path
168
+ patchright-cli screenshot --hires # Capture at device pixel ratio
160
169
  patchright-cli close # Close session
161
170
  ```
162
171
 
@@ -165,6 +174,10 @@ patchright-cli close # Close session
165
174
  patchright-cli go-back
166
175
  patchright-cli go-forward
167
176
  patchright-cli reload
177
+ patchright-cli wait 500 # Wait a fixed number of milliseconds
178
+ patchright-cli wait --url="**/dashboard" # Wait for the URL to match (`*` never crosses a `/`)
179
+ patchright-cli wait-for <ref> # Wait until an element is visible
180
+ patchright-cli wait-for <ref> --state=hidden
168
181
  ```
169
182
 
170
183
  ### Keyboard / Mouse
@@ -252,6 +265,9 @@ patchright-cli tracing-stop # Saves .zip trace file
252
265
  patchright-cli video-start # Start video recording (CDP screencast)
253
266
  patchright-cli video-stop # Stop and save video (requires ffmpeg for .webm)
254
267
  patchright-cli video-stop --filename=recording.webm
268
+ patchright-cli show --annotate # Ask a human to mark up the page, wait for it
269
+ patchright-cli video-show-actions # Annotate each action in the recording
270
+ patchright-cli video-hide-actions # Stop annotating actions
255
271
  patchright-cli pdf --filename=page.pdf
256
272
  ```
257
273
 
@@ -284,13 +300,15 @@ patchright-cli install --skills # Auto-install skills for detected AI age
284
300
 
285
301
  ### Sessions
286
302
  ```bash
287
- patchright-cli -s=mysession open https://example.com --persistent
303
+ patchright-cli -s=mysession open https://example.com
288
304
  patchright-cli -s=mysession click e6
289
305
  patchright-cli -s=mysession close
290
306
  patchright-cli list # List all sessions
291
307
  patchright-cli close-all
292
308
  patchright-cli kill-all
293
- patchright-cli delete-data # Delete persistent profile
309
+ patchright-cli delete-data # Delete the profile named after the session
310
+ patchright-cli profile-list # Profiles, size, and which session uses each
311
+ patchright-cli profile-delete <name> # Delete an idle named profile
294
312
  patchright-cli --port=9322 open # Custom daemon port
295
313
  ```
296
314
 
@@ -298,74 +316,41 @@ patchright-cli --port=9322 open # Custom daemon port
298
316
 
299
317
  ---
300
318
 
301
- ## Snapshots
302
-
303
- After each state-changing command, the CLI outputs page info and a YAML snapshot:
304
-
305
- ```
306
- ### Page
307
- - Page URL: https://example.com/
308
- - Page Title: Example Domain
309
- ### Snapshot
310
- [Snapshot](.patchright-cli/page-1774376207818.yml)
311
- ```
312
-
313
- The snapshot lists interactive elements with refs you can use in commands:
314
-
315
- ```yaml
316
- - ref: e1
317
- role: heading
318
- name: Example Domain
319
- level: 1
320
- - ref: e2
321
- role: link
322
- name: Learn more
323
- url: "https://iana.org/domains/example"
324
- ```
325
-
326
- > [!NOTE]
327
- > Use refs directly: `patchright-cli click e2`, `patchright-cli fill e5 "text"`
328
-
329
- ---
330
-
331
- ## Anti-Detect Features
332
-
333
- > [!CAUTION]
334
- > This tool is for **authorized testing, security research, and legitimate automation** only.
335
-
336
- - :white_check_mark: Real Chrome browser (not Chromium)
337
- - :white_check_mark: Patchright patches `navigator.webdriver` and other detection vectors
338
- - :white_check_mark: Persistent profiles maintain cookies/sessions across runs
339
- - :white_check_mark: No custom user-agent or headers (natural fingerprint)
340
- - :white_check_mark: Headed by default (headless is more detectable)
341
-
342
- ---
343
-
344
319
  ## Agent Integration
345
320
 
346
- Works with any AI coding agent that supports SKILL.md skills:
321
+ Works with Claude Code, Cursor, Gemini CLI, Codex, and [40+ other agents](https://github.com/vercel-labs/skills).
347
322
 
348
- | Agent | Install skill |
349
- |-------|--------------|
350
- | **Claude Code** | `mkdir -p ~/.claude/skills/patchright-cli && curl -sL https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md -o ~/.claude/skills/patchright-cli/SKILL.md` |
351
- | **OpenClaw** | `mkdir -p ~/.openclaw/skills/patchright-cli && curl -sL https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md -o ~/.openclaw/skills/patchright-cli/SKILL.md` |
352
- | **Codex CLI** | `mkdir -p ~/.codex/skills/patchright-cli && curl -sL https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md -o ~/.codex/skills/patchright-cli/SKILL.md` |
353
- | **Gemini CLI** | `mkdir -p ~/.gemini/skills/patchright-cli && curl -sL https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md -o ~/.gemini/skills/patchright-cli/SKILL.md` |
354
- | **OpenCode** | `mkdir -p ~/.opencode/skills/patchright-cli && curl -sL https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md -o ~/.opencode/skills/patchright-cli/SKILL.md` |
355
- | **Cursor** | Copy SKILL.md to `.cursor/skills/patchright-cli/` in your project |
356
- | **Windsurf** | Copy SKILL.md to `.windsurf/skills/patchright-cli/` in your project |
357
- | **Aider** | Copy SKILL.md to `.aider/skills/patchright-cli/` in your project |
323
+ ```bash
324
+ # Install skill for all detected agents (recommended)
325
+ npx skills add AhaiMk01/patchright-cli
326
+ ```
358
327
 
359
- Or auto-install for all detected agents:
328
+ <details>
329
+ <summary><b>Other install methods</b></summary>
360
330
 
361
331
  ```bash
332
+ # Via patchright-cli itself
362
333
  pip install patchright-cli
363
334
  patchright-cli install --skills
335
+
336
+ # Or just tell your agent:
337
+ # "Install patchright-cli skill from https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md"
364
338
  ```
365
339
 
366
- Or just tell your agent:
340
+ </details>
367
341
 
368
- > Install patchright-cli skill from https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md
342
+ ### Skill docs
343
+
344
+ | File | Topic |
345
+ |------|-------|
346
+ | [`SKILL.md`](skills/patchright-cli/SKILL.md) | Main skill — commands, options, patterns |
347
+ | [`snapshot-refs.md`](skills/patchright-cli/references/snapshot-refs.md) | Snapshots, element refs, `-i` flag |
348
+ | [`session-management.md`](skills/patchright-cli/references/session-management.md) | Named sessions, profiles, CDP, dashboard |
349
+ | [`request-mocking.md`](skills/patchright-cli/references/request-mocking.md) | Route mocking, network state |
350
+ | [`storage-state.md`](skills/patchright-cli/references/storage-state.md) | Cookies, localStorage, sessionStorage |
351
+ | [`running-code.md`](skills/patchright-cli/references/running-code.md) | eval, run-code, `--file`, stdin |
352
+ | [`tracing.md`](skills/patchright-cli/references/tracing.md) | Trace recording and debugging |
353
+ | [`video-recording.md`](skills/patchright-cli/references/video-recording.md) | Video, codegen, screenshot, PDF |
369
354
 
370
355
  ---
371
356
 
@@ -0,0 +1,146 @@
1
+ # patchright-cli Installation Guide
2
+
3
+ ## Prerequisites
4
+
5
+ - Python 3.10+
6
+ - Google Chrome installed on the system
7
+
8
+ ## Install
9
+
10
+ ### Step 1: Ensure uv is installed
11
+
12
+ uv is the recommended Python package manager. Check if it's installed:
13
+
14
+ ```bash
15
+ uv --version
16
+ ```
17
+
18
+ If not installed:
19
+
20
+ ```bash
21
+ # macOS / Linux
22
+ curl -LsSf https://astral.sh/uv/install.sh | sh
23
+
24
+ # Windows (PowerShell)
25
+ powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
26
+ ```
27
+
28
+ ### Step 2: Run patchright-cli
29
+
30
+ With uvx (recommended — always uses the latest version, no install needed):
31
+
32
+ ```bash
33
+ uvx patchright-cli open https://example.com
34
+ uvx patchright-cli snapshot
35
+ uvx patchright-cli close
36
+ ```
37
+
38
+ > **Note:** If you have Google Chrome installed, patchright-cli will use it directly via `channel="chrome"` for maximum stealth. If Chrome is not found, install the Patchright fallback browser: `uvx patchright install chromium`
39
+
40
+ ### Step 3: Verify
41
+
42
+ ```bash
43
+ uvx patchright-cli --version
44
+ uvx patchright-cli open https://example.com
45
+ uvx patchright-cli eval "document.title"
46
+ uvx patchright-cli close
47
+ ```
48
+
49
+ <details>
50
+ <summary><b>Alternative: pip install</b></summary>
51
+
52
+ ```bash
53
+ pip install patchright-cli
54
+ patchright-cli open https://example.com
55
+ patchright-cli close
56
+ ```
57
+
58
+ </details>
59
+
60
+ ### Troubleshooting
61
+
62
+ If you see `browser not found` errors:
63
+
64
+ ```bash
65
+ # Check if Chrome is installed
66
+ google-chrome --version # Linux
67
+ /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version # macOS
68
+ reg query "HKLM\SOFTWARE\Google\Chrome\BLBeacon" /v version # Windows
69
+
70
+ # If no Chrome, install the Patchright browser
71
+ uvx patchright install chromium
72
+ ```
73
+
74
+ If you see `patchright-cli: command not found`:
75
+
76
+ ```bash
77
+ # Use uvx instead (no install or PATH needed)
78
+ uvx patchright-cli --help
79
+ ```
80
+
81
+ ## Agent Integration
82
+
83
+ Install the patchright-cli skill so your AI coding agent knows how to use it. Works with Claude Code, Cursor, Gemini CLI, Codex, and [40+ other agents](https://github.com/vercel-labs/skills).
84
+
85
+ ### Recommended: Skills CLI
86
+
87
+ ```bash
88
+ npx skills add AhaiMk01/patchright-cli
89
+ ```
90
+
91
+ This auto-detects your installed agents and installs the skill (including reference docs) to all of them.
92
+
93
+ ### Alternative: patchright-cli built-in
94
+
95
+ ```bash
96
+ pip install patchright-cli
97
+ patchright-cli install --skills
98
+ ```
99
+
100
+ ### Alternative: Tell your agent
101
+
102
+ Just paste this into your agent and it will handle the rest:
103
+
104
+ > Install patchright-cli skill from https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md
105
+
106
+ ### Manual install
107
+
108
+ Copy the skill file to your agent's skills directory:
109
+
110
+ ```bash
111
+ # Example for Claude Code
112
+ mkdir -p ~/.claude/skills/patchright-cli
113
+ curl -sL https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md \
114
+ -o ~/.claude/skills/patchright-cli/SKILL.md
115
+ ```
116
+
117
+ Replace `~/.claude` with `~/.gemini`, `~/.codex`, `~/.opencode`, `.cursor`, etc. for other agents.
118
+
119
+ ## Usage
120
+
121
+ ```bash
122
+ # Open an anti-bot-protected site
123
+ uvx patchright-cli open https://protected-site.com
124
+
125
+ # Take a snapshot to see interactive elements
126
+ uvx patchright-cli snapshot
127
+
128
+ # Interact with elements using refs from the snapshot
129
+ uvx patchright-cli fill e3 "username"
130
+ uvx patchright-cli fill e4 "password"
131
+ uvx patchright-cli click e5
132
+
133
+ # Save login state for reuse
134
+ uvx patchright-cli state-save auth.json
135
+
136
+ # Later, restore the session
137
+ uvx patchright-cli open https://protected-site.com --persistent
138
+ uvx patchright-cli state-load auth.json
139
+
140
+ # Close when done
141
+ uvx patchright-cli close
142
+ ```
143
+
144
+ ## All Commands
145
+
146
+ Run `patchright-cli --help` for the full command reference.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "patchright-cli"
3
- version = "0.5.0"
3
+ version = "0.7.0"
4
4
  description = "Anti-detect browser automation CLI using Patchright (undetected Playwright fork)"
5
5
  license = "Apache-2.0"
6
6
  requires-python = ">=3.10"