patchright-cli 0.5.0__tar.gz → 0.6.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.
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/.gitignore +1 -0
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/PKG-INFO +25 -58
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/README.md +24 -57
- patchright_cli-0.6.0/docs/installation.md +146 -0
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/pyproject.toml +1 -1
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/skills/patchright-cli/SKILL.md +25 -23
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/src/patchright_cli/__init__.py +1 -1
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/src/patchright_cli/cli.py +26 -7
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/src/patchright_cli/daemon.py +304 -16
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/tests/test_daemon_handlers.py +237 -0
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/uv.lock +1 -1
- patchright_cli-0.5.0/docs/installation.md +0 -177
- patchright_cli-0.5.0/docs/superpowers/plans/2026-04-14-cdp-attach.md +0 -297
- patchright_cli-0.5.0/docs/superpowers/plans/2026-04-14-cli-enhancements.md +0 -529
- patchright_cli-0.5.0/docs/superpowers/plans/2026-04-14-codegen.md +0 -234
- patchright_cli-0.5.0/docs/superpowers/plans/2026-04-14-context-config-and-permissions.md +0 -411
- patchright_cli-0.5.0/docs/superpowers/plans/2026-04-14-show-dashboard.md +0 -337
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/.claude-plugin/marketplace.json +0 -0
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/.claude-plugin/skills/browser-automation.json +0 -0
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/.github/workflows/ci.yml +0 -0
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/.github/workflows/publish.yml +0 -0
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/.pre-commit-config.yaml +0 -0
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/CLAUDE.md +0 -0
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/CONTRIBUTING.md +0 -0
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/LICENSE +0 -0
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/Makefile +0 -0
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/patchright-cli +0 -0
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/patchright-cli.cmd +0 -0
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/skills/patchright-cli/references/request-mocking.md +0 -0
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/skills/patchright-cli/references/running-code.md +0 -0
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/skills/patchright-cli/references/session-management.md +0 -0
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/skills/patchright-cli/references/snapshot-refs.md +0 -0
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/skills/patchright-cli/references/storage-state.md +0 -0
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/skills/patchright-cli/references/tracing.md +0 -0
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/skills/patchright-cli/references/video-recording.md +0 -0
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/src/patchright_cli/__main__.py +0 -0
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/src/patchright_cli/dashboard.py +0 -0
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/src/patchright_cli/ref_registry.py +0 -0
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/src/patchright_cli/snapshot.py +0 -0
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/tests/__init__.py +0 -0
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/tests/fixture.html +0 -0
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/tests/test_cli_config.py +0 -0
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/tests/test_e2e.py +0 -0
- {patchright_cli-0.5.0 → patchright_cli-0.6.0}/tests/test_ref_registry.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: patchright-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.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
|
|
@@ -331,74 +331,41 @@ patchright-cli --port=9322 open # Custom daemon port
|
|
|
331
331
|
|
|
332
332
|
---
|
|
333
333
|
|
|
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
334
|
## Agent Integration
|
|
378
335
|
|
|
379
|
-
Works with
|
|
336
|
+
Works with Claude Code, Cursor, Gemini CLI, Codex, and [40+ other agents](https://github.com/vercel-labs/skills).
|
|
380
337
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
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 |
|
|
338
|
+
```bash
|
|
339
|
+
# Install skill for all detected agents (recommended)
|
|
340
|
+
npx skills add AhaiMk01/patchright-cli
|
|
341
|
+
```
|
|
391
342
|
|
|
392
|
-
|
|
343
|
+
<details>
|
|
344
|
+
<summary><b>Other install methods</b></summary>
|
|
393
345
|
|
|
394
346
|
```bash
|
|
347
|
+
# Via patchright-cli itself
|
|
395
348
|
pip install patchright-cli
|
|
396
349
|
patchright-cli install --skills
|
|
350
|
+
|
|
351
|
+
# Or just tell your agent:
|
|
352
|
+
# "Install patchright-cli skill from https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md"
|
|
397
353
|
```
|
|
398
354
|
|
|
399
|
-
|
|
355
|
+
</details>
|
|
400
356
|
|
|
401
|
-
|
|
357
|
+
### Skill docs
|
|
358
|
+
|
|
359
|
+
| File | Topic |
|
|
360
|
+
|------|-------|
|
|
361
|
+
| [`SKILL.md`](skills/patchright-cli/SKILL.md) | Main skill — commands, options, patterns |
|
|
362
|
+
| [`snapshot-refs.md`](skills/patchright-cli/references/snapshot-refs.md) | Snapshots, element refs, `-i` flag |
|
|
363
|
+
| [`session-management.md`](skills/patchright-cli/references/session-management.md) | Named sessions, profiles, CDP, dashboard |
|
|
364
|
+
| [`request-mocking.md`](skills/patchright-cli/references/request-mocking.md) | Route mocking, network state |
|
|
365
|
+
| [`storage-state.md`](skills/patchright-cli/references/storage-state.md) | Cookies, localStorage, sessionStorage |
|
|
366
|
+
| [`running-code.md`](skills/patchright-cli/references/running-code.md) | eval, run-code, `--file`, stdin |
|
|
367
|
+
| [`tracing.md`](skills/patchright-cli/references/tracing.md) | Trace recording and debugging |
|
|
368
|
+
| [`video-recording.md`](skills/patchright-cli/references/video-recording.md) | Video, codegen, screenshot, PDF |
|
|
402
369
|
|
|
403
370
|
---
|
|
404
371
|
|
|
@@ -298,74 +298,41 @@ patchright-cli --port=9322 open # Custom daemon port
|
|
|
298
298
|
|
|
299
299
|
---
|
|
300
300
|
|
|
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
301
|
## Agent Integration
|
|
345
302
|
|
|
346
|
-
Works with
|
|
303
|
+
Works with Claude Code, Cursor, Gemini CLI, Codex, and [40+ other agents](https://github.com/vercel-labs/skills).
|
|
347
304
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
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 |
|
|
305
|
+
```bash
|
|
306
|
+
# Install skill for all detected agents (recommended)
|
|
307
|
+
npx skills add AhaiMk01/patchright-cli
|
|
308
|
+
```
|
|
358
309
|
|
|
359
|
-
|
|
310
|
+
<details>
|
|
311
|
+
<summary><b>Other install methods</b></summary>
|
|
360
312
|
|
|
361
313
|
```bash
|
|
314
|
+
# Via patchright-cli itself
|
|
362
315
|
pip install patchright-cli
|
|
363
316
|
patchright-cli install --skills
|
|
317
|
+
|
|
318
|
+
# Or just tell your agent:
|
|
319
|
+
# "Install patchright-cli skill from https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md"
|
|
364
320
|
```
|
|
365
321
|
|
|
366
|
-
|
|
322
|
+
</details>
|
|
367
323
|
|
|
368
|
-
|
|
324
|
+
### Skill docs
|
|
325
|
+
|
|
326
|
+
| File | Topic |
|
|
327
|
+
|------|-------|
|
|
328
|
+
| [`SKILL.md`](skills/patchright-cli/SKILL.md) | Main skill — commands, options, patterns |
|
|
329
|
+
| [`snapshot-refs.md`](skills/patchright-cli/references/snapshot-refs.md) | Snapshots, element refs, `-i` flag |
|
|
330
|
+
| [`session-management.md`](skills/patchright-cli/references/session-management.md) | Named sessions, profiles, CDP, dashboard |
|
|
331
|
+
| [`request-mocking.md`](skills/patchright-cli/references/request-mocking.md) | Route mocking, network state |
|
|
332
|
+
| [`storage-state.md`](skills/patchright-cli/references/storage-state.md) | Cookies, localStorage, sessionStorage |
|
|
333
|
+
| [`running-code.md`](skills/patchright-cli/references/running-code.md) | eval, run-code, `--file`, stdin |
|
|
334
|
+
| [`tracing.md`](skills/patchright-cli/references/tracing.md) | Trace recording and debugging |
|
|
335
|
+
| [`video-recording.md`](skills/patchright-cli/references/video-recording.md) | Video, codegen, screenshot, PDF |
|
|
369
336
|
|
|
370
337
|
---
|
|
371
338
|
|
|
@@ -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.
|
|
@@ -58,6 +58,8 @@ These go before the command:
|
|
|
58
58
|
--timeout-action=10000 # Default action timeout (ms)
|
|
59
59
|
--timeout-navigation=30000 # Default navigation timeout (ms)
|
|
60
60
|
--show-port=9322 # Dashboard port (default: 9322)
|
|
61
|
+
--raw # Strip page/snapshot decorations from output
|
|
62
|
+
--json # Wrap full response as JSON ({success, output, ...})
|
|
61
63
|
```
|
|
62
64
|
|
|
63
65
|
---
|
|
@@ -71,7 +73,8 @@ open [url] # Launch browser (optionally navigate)
|
|
|
71
73
|
open --persistent # Keep cookies/storage between runs
|
|
72
74
|
open --headless # Headless mode
|
|
73
75
|
attach --cdp=<url> # Attach to existing Chrome via CDP
|
|
74
|
-
close # Close session
|
|
76
|
+
close # Close session (closes the browser)
|
|
77
|
+
detach # Detach an attached session (keeps external browser running)
|
|
75
78
|
```
|
|
76
79
|
|
|
77
80
|
### Navigation
|
|
@@ -91,6 +94,7 @@ snapshot # Full page snapshot
|
|
|
91
94
|
snapshot <ref> # Subtree of a specific element
|
|
92
95
|
snapshot --depth=N # Limit depth
|
|
93
96
|
snapshot -i # Interactive elements only
|
|
97
|
+
snapshot --boxes # Append [box=x,y,w,h] to each [ref=eN] line
|
|
94
98
|
```
|
|
95
99
|
|
|
96
100
|
### Interaction
|
|
@@ -102,6 +106,8 @@ click <ref> --modifiers=Alt # Click with modifier keys
|
|
|
102
106
|
dblclick <ref> # Double-click
|
|
103
107
|
hover <ref> # Hover
|
|
104
108
|
drag <ref> <target-ref> # Drag element to target
|
|
109
|
+
drop <ref> --path=./file.png # Drop file onto element (HTML5 drop from outside)
|
|
110
|
+
drop <ref> --data="text/plain=hello" # Drop arbitrary MIME data
|
|
105
111
|
```
|
|
106
112
|
|
|
107
113
|
### Form input
|
|
@@ -170,8 +176,14 @@ dialog-dismiss # Dismiss next dialog
|
|
|
170
176
|
```bash
|
|
171
177
|
console # Show console messages
|
|
172
178
|
console warning # Filter by level
|
|
173
|
-
network # Show network requests
|
|
179
|
+
network # Show network requests (each line is `#<id> METHOD STATUS URL`)
|
|
180
|
+
requests # Alias for `network`
|
|
174
181
|
network --static # Include static assets
|
|
182
|
+
request <id> # Full detail for one request (headers + body)
|
|
183
|
+
request <id> --body # Also fetch response body
|
|
184
|
+
generate-locator <ref> # Emit Playwright locator string for a ref
|
|
185
|
+
highlight <ref> # Persistent overlay on element [--style=CSS]
|
|
186
|
+
highlight <ref> --hide # Remove overlay; `highlight --hide` clears all
|
|
175
187
|
```
|
|
176
188
|
|
|
177
189
|
### Recording and capture
|
|
@@ -312,30 +324,20 @@ pip install patchright-cli
|
|
|
312
324
|
|
|
313
325
|
### Skill (for AI coding agents)
|
|
314
326
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
| Agent | Install / update command |
|
|
320
|
-
|-------|--------------------------|
|
|
321
|
-
| **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` |
|
|
322
|
-
| **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` |
|
|
323
|
-
| **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` |
|
|
324
|
-
| **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` |
|
|
325
|
-
|
|
326
|
-
**Windows (PowerShell):**
|
|
327
|
+
```bash
|
|
328
|
+
# Install for all detected agents (Claude Code, Cursor, Gemini, Codex, 40+ more)
|
|
329
|
+
npx skills add AhaiMk01/patchright-cli
|
|
330
|
+
```
|
|
327
331
|
|
|
328
|
-
|
|
329
|
-
|-------|--------------------------|
|
|
330
|
-
| **Claude Code** | `New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.claude\skills\patchright-cli" | Out-Null; Invoke-WebRequest -Uri "https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md" -OutFile "$env:USERPROFILE\.claude\skills\patchright-cli\SKILL.md"` |
|
|
331
|
-
| **Gemini CLI** | `New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.gemini\skills\patchright-cli" | Out-Null; Invoke-WebRequest -Uri "https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md" -OutFile "$env:USERPROFILE\.gemini\skills\patchright-cli\SKILL.md"` |
|
|
332
|
-
| **Codex CLI** | `New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.codex\skills\patchright-cli" | Out-Null; Invoke-WebRequest -Uri "https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md" -OutFile "$env:USERPROFILE\.codex\skills\patchright-cli\SKILL.md"` |
|
|
333
|
-
| **OpenCode** | `New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.opencode\skills\patchright-cli" | Out-Null; Invoke-WebRequest -Uri "https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md" -OutFile "$env:USERPROFILE\.opencode\skills\patchright-cli\SKILL.md"` |
|
|
332
|
+
Other methods:
|
|
334
333
|
|
|
335
|
-
|
|
334
|
+
```bash
|
|
335
|
+
# Via patchright-cli itself
|
|
336
|
+
pip install patchright-cli && patchright-cli install --skills
|
|
336
337
|
|
|
337
|
-
|
|
338
|
-
|
|
338
|
+
# Or just tell your agent:
|
|
339
|
+
# "Install patchright-cli skill from https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md"
|
|
340
|
+
```
|
|
339
341
|
|
|
340
342
|
## Specific tasks
|
|
341
343
|
|
|
@@ -180,12 +180,14 @@ COMMANDS_HELP = {
|
|
|
180
180
|
"select": "select <ref> <value> Select dropdown option",
|
|
181
181
|
"check": "check <ref> Check checkbox/radio",
|
|
182
182
|
"uncheck": "uncheck <ref> Uncheck checkbox/radio",
|
|
183
|
-
"snapshot": "snapshot [ref] Take accessibility snapshot [--filename=F] [--depth=N] [-i]",
|
|
183
|
+
"snapshot": "snapshot [ref] Take accessibility snapshot [--filename=F] [--depth=N] [-i] [--boxes]",
|
|
184
184
|
"eval": "eval <expr> [ref] Evaluate JavaScript [--file=F or stdin]",
|
|
185
185
|
"text": "text <ref|selector> Get text content of element",
|
|
186
186
|
"screenshot": "screenshot [ref] Save screenshot [--full-page] [--filename=F]",
|
|
187
187
|
"drag": "drag <from> <to> Drag element to target",
|
|
188
|
+
"drop": "drop <ref> [--path=F] [--data=mime=value] Drop file/data onto element",
|
|
188
189
|
"close": "close Close browser session",
|
|
190
|
+
"detach": "detach Detach attached session (keep external browser running)",
|
|
189
191
|
# Navigation
|
|
190
192
|
"go-back": "go-back Go back",
|
|
191
193
|
"go-forward": "go-forward Go forward",
|
|
@@ -260,6 +262,10 @@ COMMANDS_HELP = {
|
|
|
260
262
|
# DevTools
|
|
261
263
|
"console": "console [level] Show console messages [--clear]",
|
|
262
264
|
"network": "network Show network requests [--static] [--clear]",
|
|
265
|
+
"requests": "requests Alias for `network`",
|
|
266
|
+
"request": "request <id> Show full detail for a network request [--body]",
|
|
267
|
+
"generate-locator": "generate-locator <ref> Emit Playwright locator expression for a ref",
|
|
268
|
+
"highlight": "highlight <ref> Show overlay on element [--style=CSS] [--hide]",
|
|
263
269
|
# Session
|
|
264
270
|
"list": "list List sessions",
|
|
265
271
|
"close-all": "close-all Close all sessions",
|
|
@@ -300,6 +306,7 @@ def _print_help():
|
|
|
300
306
|
click.echo(" --cdp=<url> Attach to Chrome via CDP endpoint")
|
|
301
307
|
click.echo(" --show-port=N Dashboard port (default: 9322)")
|
|
302
308
|
click.echo(" --raw Raw output (strip page/snapshot decorations)")
|
|
309
|
+
click.echo(" --json Wrap response as JSON ({success, output, ...})")
|
|
303
310
|
click.echo(" --version Show version")
|
|
304
311
|
click.echo(" --help Show this help\n")
|
|
305
312
|
click.echo("Commands:")
|
|
@@ -324,7 +331,9 @@ def _print_help():
|
|
|
324
331
|
"text",
|
|
325
332
|
"screenshot",
|
|
326
333
|
"drag",
|
|
334
|
+
"drop",
|
|
327
335
|
"close",
|
|
336
|
+
"detach",
|
|
328
337
|
],
|
|
329
338
|
),
|
|
330
339
|
("Navigation", ["go-back", "go-forward", "reload", "url", "title"]),
|
|
@@ -363,7 +372,7 @@ def _print_help():
|
|
|
363
372
|
("Tracing", ["tracing-start", "tracing-stop"]),
|
|
364
373
|
("Video", ["video-start", "video-stop", "video-chapter"]),
|
|
365
374
|
("PDF", ["pdf"]),
|
|
366
|
-
("DevTools", ["console", "network"]),
|
|
375
|
+
("DevTools", ["console", "network", "requests", "request", "generate-locator", "highlight"]),
|
|
367
376
|
("Session", ["list", "close-all", "kill-all", "delete-data"]),
|
|
368
377
|
("Dashboard", ["show"]),
|
|
369
378
|
("Codegen", ["codegen", "codegen-stop"]),
|
|
@@ -390,6 +399,7 @@ def main():
|
|
|
390
399
|
port = DEFAULT_PORT
|
|
391
400
|
extra_opts: dict = {}
|
|
392
401
|
raw = False
|
|
402
|
+
as_json = False
|
|
393
403
|
|
|
394
404
|
# Extract options
|
|
395
405
|
remaining = []
|
|
@@ -484,6 +494,8 @@ def main():
|
|
|
484
494
|
extra_opts["show-port"] = argv[i]
|
|
485
495
|
elif arg == "--raw":
|
|
486
496
|
raw = True
|
|
497
|
+
elif arg == "--json":
|
|
498
|
+
as_json = True
|
|
487
499
|
elif arg in ("-i", "--interactive"):
|
|
488
500
|
extra_opts["interactive"] = True
|
|
489
501
|
elif arg in ("--version", "-v"):
|
|
@@ -579,13 +591,20 @@ def main():
|
|
|
579
591
|
|
|
580
592
|
# Print output
|
|
581
593
|
output = response.get("output", "")
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
594
|
+
success = response.get("success", True)
|
|
595
|
+
|
|
596
|
+
if as_json:
|
|
597
|
+
payload = dict(response)
|
|
598
|
+
if raw and isinstance(payload.get("output"), str):
|
|
599
|
+
payload["output"] = _strip_raw_output(payload["output"])
|
|
600
|
+
click.echo(json.dumps(payload, default=str))
|
|
601
|
+
else:
|
|
585
602
|
if output:
|
|
586
|
-
|
|
603
|
+
if raw:
|
|
604
|
+
output = _strip_raw_output(output)
|
|
605
|
+
if output:
|
|
606
|
+
click.echo(output)
|
|
587
607
|
|
|
588
|
-
success = response.get("success", True)
|
|
589
608
|
if not success:
|
|
590
609
|
sys.exit(1)
|
|
591
610
|
|