patchright-cli 0.9.0__py3-none-any.whl → 0.10.0__py3-none-any.whl

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.
@@ -1,3 +1,3 @@
1
1
  """patchright-cli — Undetected browser automation CLI using Patchright."""
2
2
 
3
- __version__ = "0.9.0"
3
+ __version__ = "0.10.0"
@@ -1,6 +1,6 @@
1
1
  """Allow running as `python -m patchright_cli`."""
2
2
 
3
- from patchright_cli.cli import main
3
+ from patchright_cli._entry import main
4
4
 
5
5
  if __name__ == "__main__":
6
6
  main()
@@ -0,0 +1,26 @@
1
+ """Console-script entry point with a `--version` fast path.
2
+
3
+ Agents probe `--version` constantly, so a bare version flag is answered here
4
+ from the leaf `patchright_cli/__init__.py`, before cli.py pulls in click and
5
+ the daemon (and with it Patchright). Everything else goes to cli.main().
6
+ """
7
+
8
+ import sys
9
+
10
+ _VERSION_FLAGS = ("-v", "-V", "--version")
11
+
12
+
13
+ def main() -> None:
14
+ if len(sys.argv) == 2 and sys.argv[1] in _VERSION_FLAGS:
15
+ from patchright_cli import __version__
16
+
17
+ sys.stdout.write(__version__ + "\n")
18
+ return
19
+
20
+ from patchright_cli.cli import main as cli_main
21
+
22
+ cli_main()
23
+
24
+
25
+ if __name__ == "__main__":
26
+ main()
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: patchright-cli
3
- description: Anti-detect browser automation using Patchright (undetected Playwright fork). Use when you need to interact with websites that block regular Playwright/Chrome DevTools, such as Akamai/Cloudflare-protected sites. Provides the same command interface as playwright-cli but bypasses bot detection. Use this skill whenever the user asks to automate a browser, scrape a website, fill forms, log into sites, take screenshots, or do anything involving Chrome automation — especially if the target site has bot protection like Cloudflare or Akamai.
3
+ description: Anti-detect browser automation using Patchright (undetected Playwright fork). Use when you need to interact with websites that block regular Playwright/Chrome DevTools, such as Akamai/Cloudflare-protected sites. Uses playwright-cli style commands (not a drop-in replacement) but bypasses bot detection. Use this skill whenever the user asks to automate a browser, scrape a website, fill forms, log into sites, take screenshots, or do anything involving Chrome automation — especially if the target site has bot protection like Cloudflare or Akamai.
4
4
  ---
5
5
 
6
6
  # Anti-Detect Browser Automation with patchright-cli
@@ -59,8 +59,21 @@ patchright-cli goto "https://example.com/search?q=cats&page=2"
59
59
  ```
60
60
 
61
61
  The same applies to `#` (a bash comment), spaces, and `%` (expanded by
62
- cmd.exe), and to any argument holding shell metacharacters. Quoting always
63
- works; leave it on.
62
+ cmd.exe), and to any argument holding shell metacharacters. Quoting works for
63
+ the installed `patchright-cli.exe` in bash, PowerShell and cmd.exe; leave it on.
64
+
65
+ On Windows, two cases need more than quotes:
66
+
67
+ ```
68
+ # cmd.exe without quotes: escape the & as ^&. Inside quotes ^ is kept
69
+ # literally, so use one or the other, never both.
70
+ patchright-cli goto https://example.com/search?q=cats^&page=2
71
+
72
+ # PowerShell calling a .cmd/.bat wrapper (such as the repo's patchright-cli.cmd):
73
+ # PowerShell drops the quotes and cmd.exe splits at &. Pass the rest verbatim
74
+ # with --%. Don't use --% with patchright-cli.exe: in PowerShell 7 the quotes end up in the URL.
75
+ .\patchright-cli.cmd --% goto "https://example.com/search?q=cats&page=2"
76
+ ```
64
77
 
65
78
  ## Global options
66
79
 
@@ -88,6 +101,8 @@ These go before the command:
88
101
  --show-port=9322 # Dashboard port (default: 9322)
89
102
  --raw # Strip page/snapshot decorations from output
90
103
  --json # Wrap full response as JSON ({success, output, ...})
104
+ --toon # TOON for results with structured data (list, tab-list, cookie-list,
105
+ # find, console, network, url, title, ...); others print as usual
91
106
  ```
92
107
 
93
108
  These go *after* the command instead:
@@ -222,14 +237,6 @@ press <key> # Keypress (Enter, ArrowDown, etc.)
222
237
  keydown <key> / keyup <key> # Hold/release key
223
238
  ```
224
239
 
225
- ### Mouse
226
-
227
- ```bash
228
- mousemove <x> <y> # Move to coordinates
229
- mousedown / mouseup # Button down/up
230
- mousewheel <dx> <dy> # Scroll wheel
231
- ```
232
-
233
240
  ### Tabs
234
241
 
235
242
  ```bash
@@ -320,36 +327,191 @@ show # Live dashboard
320
327
  show --annotate # Ask a human to mark up the page and wait for it
321
328
  ```
322
329
 
323
- ### Storage
324
-
325
- ```bash
326
- cookie-list / cookie-get / cookie-set / cookie-delete / cookie-clear
327
- cookie-export / cookie-import
328
- localstorage-list / localstorage-get / localstorage-set / localstorage-delete / localstorage-clear
329
- sessionstorage-list / sessionstorage-get / sessionstorage-set / sessionstorage-delete / sessionstorage-clear
330
- state-save <file> / state-load <file>
331
- ```
332
-
333
- ### Network
334
-
335
- ```bash
336
- route "<pattern>" [options] # Mock requests (--status, --body, --content-type, --header)
337
- route-list / unroute # Manage routes
338
- network-state-set offline # Simulate offline
339
- network-state-set online # Restore connectivity
340
- ```
341
-
342
- ### Sessions
343
-
344
- ```bash
345
- list # List active sessions
346
- close-all # Close all sessions
347
- kill-all # Force-kill all + stop daemon
348
- delete-data # Delete session profile data
349
- profile-list # List profiles, size, and which session uses each
350
- profile-delete <name> # Delete an idle named profile
351
- grant-permissions <perms> # Grant browser permissions
352
- ```
330
+ ### Emulation
331
+
332
+ Each setting holds for the whole session: every open tab, and tabs and popups
333
+ opened later (a popup gets it just after it opens). `clear-*` drops just that
334
+ one, back to the browser default.
335
+
336
+ ```bash
337
+ set-color-scheme dark # dark | light | no-preference
338
+ clear-color-scheme
339
+ set-reduced-motion reduce # reduce | no-preference
340
+ clear-reduced-motion
341
+ set-forced-colors active # active | none
342
+ clear-forced-colors
343
+ set-contrast more # more | no-preference
344
+ clear-contrast
345
+ set-media print # screen | print
346
+ clear-media
347
+ ```
348
+
349
+ ### Network mocking
350
+
351
+ `route "<pattern>"` mocks matching requests (`--status`, `--body`,
352
+ `--content-type`, `--header`); `route-list` and `unroute` manage them, and
353
+ `network-state-set offline|online` simulates connectivity.
354
+
355
+ ## Command reference
356
+
357
+ Every command, its flags and what it does. `patchright-cli <command> --help`
358
+ shows one command's flag defaults and examples; `patchright-cli` with no
359
+ arguments shows whether the daemon is up and which sessions are open.
360
+
361
+ <!-- BEGIN GENERATED: commands (scripts/gen_skill.py from COMMAND_SPECS; do not edit by hand) -->
362
+ ```bash
363
+ # Core
364
+ open [url] [--block-networks] [--headed] # Open browser (starts daemon if needed)
365
+ attach --cdp=<url> [--cdp-headers] [--cdp-timeout] [--block-networks] # Attach to running Chrome via CDP
366
+ goto <url> # Navigate to URL
367
+ click <ref> [button] [--modifiers] # Click element
368
+ dblclick <ref> [button] [--modifiers] # Double-click element
369
+ fill <ref> <value> [--submit] # Fill text into element
370
+ type <text> [--submit] # Type text via keyboard
371
+ hover <ref> # Hover over element
372
+ select <ref> <value> # Select dropdown option
373
+ check <ref> # Check checkbox/radio
374
+ uncheck <ref> # Uncheck checkbox/radio
375
+ snapshot [ref] [--selector] [--filename] [--depth] [--interactive] [--boxes] # Take accessibility snapshot
376
+ find <text> [--regex] [--all] [--limit] # Search the snapshot for matching elements
377
+ eval <expr> [ref] [--file] # Evaluate JavaScript (expression, --file or stdin)
378
+ text <ref|selector> # Get text content of element
379
+ screenshot [ref] [--full-page] [--hires] [--filename] # Save screenshot
380
+ drag <from> <to> # Drag element to target
381
+ drop <ref> [--path] [--data] # Drop file/data onto element
382
+ close # Close browser session (or the --tab it is addressed to)
383
+ detach # Detach attached session (keep external browser running)
384
+
385
+ # Navigation
386
+ go-back # Go back
387
+ go-forward # Go forward
388
+ reload # Reload page
389
+ url # Print current URL
390
+ title # Print page title
391
+
392
+ # Keyboard
393
+ press <key> # Press key
394
+ keydown <key> # Key down
395
+ keyup <key> # Key up
396
+
397
+ # Mouse
398
+ mousemove <x> <y> # Move mouse
399
+ mousedown [button] # Mouse button down
400
+ mouseup [button] # Mouse button up
401
+ mousewheel <dx> <dy> # Scroll mouse wheel
402
+
403
+ # Scroll & Wait
404
+ scroll <dx> <dy> # Scroll by pixel offset
405
+ scroll-to <ref> # Scroll element into view
406
+ wait [ms] [--url] # Wait for milliseconds, or for a URL
407
+ wait-for <ref> [--state] # Wait for element to reach a state
408
+
409
+ # Tabs
410
+ tab-list # List tabs
411
+ tab-new [url] # Open new tab
412
+ tab-close [index] # Close tab
413
+ tab-select <index> # Switch to tab (default tab only)
414
+
415
+ # Dialog
416
+ dialog-accept [text] # Accept next dialog
417
+ dialog-dismiss # Dismiss next dialog
418
+
419
+ # Upload/Resize
420
+ upload <file> [ref] # Upload file to input
421
+ resize <w> <h> # Resize viewport
422
+
423
+ # Emulation
424
+ set-color-scheme <dark|light|no-preference> # Emulate prefers-color-scheme
425
+ clear-color-scheme # Stop emulating prefers-color-scheme
426
+ set-reduced-motion <reduce|no-preference> # Emulate prefers-reduced-motion
427
+ clear-reduced-motion # Stop emulating prefers-reduced-motion
428
+ set-forced-colors <active|none> # Emulate forced-colors
429
+ clear-forced-colors # Stop emulating forced-colors
430
+ set-contrast <more|no-preference> # Emulate prefers-contrast
431
+ clear-contrast # Stop emulating prefers-contrast
432
+ set-media <screen|print> # Emulate CSS media type
433
+ clear-media # Stop emulating the CSS media type
434
+
435
+ # State
436
+ state-save [file] # Save cookies+storage to JSON
437
+ state-load <file> # Load saved state
438
+
439
+ # Storage
440
+ cookie-list [--domain] [--path] # List cookies
441
+ cookie-get <name> # Get cookie
442
+ cookie-set <name> <value> [--domain] [--path] [--expires] [--httpOnly] [--secure] [--sameSite] # Set cookie
443
+ cookie-delete <name> # Delete cookie
444
+ cookie-clear # Clear all cookies
445
+ cookie-import <file> # Import cookies from JSON
446
+ cookie-export [file] # Export cookies to JSON
447
+ localstorage-list # List localStorage
448
+ localstorage-get <key> # Get localStorage item
449
+ localstorage-set <key> <value> # Set localStorage item
450
+ localstorage-delete <key> # Delete localStorage item
451
+ localstorage-clear # Clear localStorage
452
+ sessionstorage-list # List sessionStorage
453
+ sessionstorage-get <key> # Get sessionStorage item
454
+ sessionstorage-set <key> <value> # Set sessionStorage item
455
+ sessionstorage-delete <key> # Delete sessionStorage item
456
+ sessionstorage-clear # Clear sessionStorage
457
+
458
+ # Permissions
459
+ grant-permissions <perms> [--origin] # Grant comma-separated permissions
460
+
461
+ # Route
462
+ route <pattern> [--status] [--body] [--content-type] [--header] [--remove-header] # Mock requests matching a URL pattern
463
+ route-list # List active routes
464
+ unroute [pattern] # Remove route(s)
465
+ network-state-set <online|offline> # Set online/offline
466
+
467
+ # Code
468
+ run-code <code> [--file] # Run raw JS in page context (code, --file or stdin)
469
+
470
+ # Tracing
471
+ tracing-start # Start Playwright tracing
472
+ tracing-stop # Stop tracing and save
473
+
474
+ # Video
475
+ video-start # Start video recording
476
+ video-stop [--filename] # Stop recording and save
477
+ video-chapter <title> # Add chapter marker to video
478
+ video-show-actions [--duration] [--position] # Annotate actions in the recording
479
+ video-hide-actions # Stop annotating actions
480
+
481
+ # PDF
482
+ pdf [--filename] # Save page as PDF
483
+
484
+ # DevTools
485
+ console [level] [--clear] # Show console messages
486
+ network [--static] [--clear] # Show network requests
487
+ requests [--static] [--clear] # Alias for `network`
488
+ request <id> [--body] # Show full detail for a network request
489
+ generate-locator <ref> # Emit Playwright locator expression for a ref
490
+ highlight <ref> [--style] [--hide] # Show overlay on element
491
+
492
+ # Session
493
+ list # List sessions
494
+ close-all # Close all sessions
495
+ kill-all [--force] # Kill all sessions and stop the daemon
496
+ delete-data # Delete this session's profile
497
+
498
+ # Profiles
499
+ profile-list # List profiles, their size and which session uses them
500
+ profile-delete <name> # Delete a named profile
501
+
502
+ # Dashboard
503
+ show [--annotate] [--wait] [--no-open] # Open session dashboard
504
+
505
+ # Codegen
506
+ codegen [file] # Start recording interactions
507
+ codegen-stop [file] # Stop recording and save script
508
+
509
+ # Setup
510
+ install --skills | --hooks [--uninstall] # Install agent skill files, or session-start hooks
511
+ mcp [--http] [--host=HOST] [--port=N] # Start MCP server (stdio by default)
512
+ daemon-info --json # Show daemon client protocol and token path without starting it
513
+ ```
514
+ <!-- END GENERATED -->
353
515
 
354
516
  ---
355
517