browser4-cli 0.1.27 → 0.1.28

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/README.md CHANGED
@@ -169,8 +169,8 @@ browser4-cli -s mysession goto https://example.com
169
169
 
170
170
  | Command | Description |
171
171
  |---|---|
172
- | `click <ref> [button]` | Click an element. `--modifiers` for modifier keys. |
173
- | `dblclick <ref> [button]` | Double-click an element. `--modifiers` for modifier keys. |
172
+ | `click <ref> [button]` | Click an element. `--modifiers` for modifier keys, `--follow` to detect and switch to new tabs opened by the click. |
173
+ | `dblclick <ref> [button]` | Double-click an element. `--modifiers` for modifier keys, `--follow` to detect and switch to new tabs. |
174
174
  | `hover <ref>` | Hover over an element. |
175
175
  | `drag <startRef> <endRef>` | Drag and drop between two elements. |
176
176
  | `fill <ref> <text>` | Fill text into an editable element. `--submit` to press Enter after. `--verify` to confirm. |
@@ -193,7 +193,7 @@ browser4-cli select e12 "option-value"
193
193
 
194
194
  | Command | Description |
195
195
  |---|---|
196
- | `press <key> [ref]` | Press a key (`a`, `Enter`, `ArrowLeft`, `Escape`). Supports `--verify`. |
196
+ | `press <key> [ref]` | Press a key (`a`, `Enter`, `ArrowLeft`, `Escape`). Supports `--verify`, `--follow` (detect new tabs). |
197
197
  | `keydown <key>` | Press and hold a key. |
198
198
  | `keyup <key>` | Release a key. |
199
199
  | `mousemove <x> <y>` | Move mouse to coordinates. |
@@ -264,11 +264,11 @@ browser4-cli tab-close 1
264
264
  |---|---|
265
265
  | `snapshot` | Capture an accessibility snapshot. See [Snapshot](#snapshot) below. |
266
266
  | `get <mode> <selector> [name]` | Extract data from a page element in one of six modes (see below). |
267
- | `eval <expression> [ref]` | Evaluate JavaScript on the page or a target element. `--file <path>` to read from file. `--json` to wrap scalar results. |
267
+ | `eval <expression> [ref]` | Evaluate JavaScript on the page or a target element. `--file <path>`, `--base64`, or `--stdin` to provide the expression. `--json` to wrap scalar results. |
268
268
  | `generate-locator <ref>` | Generate a stable CSS selector path for an element. |
269
269
  | `htmlsnapshot` | Short form of `htmlsnapshot capture`. Capture a static HTML snapshot. See [HTML Snapshot](#dom-snapshot) below. |
270
270
  | `htmlsnapshot capture` | Capture a static HTML snapshot. See [HTML Snapshot](#dom-snapshot) below. |
271
- | `extract <instruction>` | Extract structured data with AI. `--schema <file>` for typed output. `--filename <path>`, `--raw`. |
271
+ | `extract <instruction>` | Extract structured data with AI. `--schema <json>` for typed output. `--filename <path>`, `--raw`. |
272
272
  | `summarize [instruction]` | Summarize page content with AI. `--selector <css>`, `--filename <path>`, `--raw`. |
273
273
 
274
274
  `get` modes:
@@ -286,8 +286,10 @@ browser4-cli tab-close 1
286
286
  browser4-cli eval "document.title"
287
287
  browser4-cli eval "el => el.textContent" e15
288
288
  browser4-cli eval --file script.js
289
+ browser4-cli eval --base64 ZG9jdW1lbnQudGl0bGU=
289
290
  browser4-cli generate-locator e5
290
291
  browser4-cli extract "product name, price, and rating"
292
+ browser4-cli extract "contacts" --schema '{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"}}}'
291
293
  browser4-cli summarize --selector "#reviews"
292
294
  ```
293
295
 
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browser4-cli",
3
- "version": "0.1.27",
3
+ "version": "0.1.28",
4
4
  "description": "Browser automation CLI for AI agents",
5
5
  "type": "module",
6
6
  "files": [
@@ -101,11 +101,16 @@ case "$BUNDLE_ARCHIVE" in
101
101
  tar xzf "$BUNDLE_ARCHIVE" -C "$EXTRACT_DIR"
102
102
  ;;
103
103
  *.zip)
104
+ # On Windows (Git Bash / MSYS2), Python is a native Windows program.
105
+ # MSYS2 auto-converts command-line *arguments* that look like Unix
106
+ # paths, but it cannot see paths embedded inside a -c string literal.
107
+ # Pass the paths as sys.argv entries so they are correctly translated
108
+ # to Windows-native paths before Python receives them.
104
109
  python3 -c "
105
110
  import zipfile, sys
106
- with zipfile.ZipFile('$BUNDLE_ARCHIVE', 'r') as z:
107
- z.extractall('$EXTRACT_DIR')
108
- " 2>/dev/null || unzip -q "$BUNDLE_ARCHIVE" -d "$EXTRACT_DIR"
111
+ with zipfile.ZipFile(sys.argv[1], 'r') as z:
112
+ z.extractall(sys.argv[2])
113
+ " "$BUNDLE_ARCHIVE" "$EXTRACT_DIR" 2>/dev/null || unzip -q "$BUNDLE_ARCHIVE" -d "$EXTRACT_DIR"
109
114
  ;;
110
115
  *)
111
116
  fail "Unsupported archive format: $BUNDLE_ARCHIVE (expected .tar.gz or .zip)"