@mefistofelix/cdp.js 0.1.0 → 0.1.1
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 +33 -4
- package/cdp.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -199,6 +199,7 @@ local configuration.
|
|
|
199
199
|
| `user_data_dir` | absolute path string, `<base_path>/<name>` | Chromium user-data directory containing profiles such as `Default`. The generated default is absolute; explicit overrides should be absolute too. |
|
|
200
200
|
| `executable_path` | string, automatic discovery | Executable to spawn; takes precedence over `CDP_BROWSER`. |
|
|
201
201
|
| `headless` | boolean, `false` | When true, add `headless: 'new'` and default `window-size: '1440,900'`. |
|
|
202
|
+
| `windowsHide` | boolean, `true` | Hide the spawned process's console on Windows. Passed to Node's `spawn`, independently of `headless`; does not hide the parent terminal. |
|
|
202
203
|
| `extensions` | boolean, `false` | When true, omit the two extension-disabling switches; does not install extensions. |
|
|
203
204
|
| `images` | boolean, `true` | When false, request `blink-settings: 'imagesEnabled=false'`; controls loading, not image processing. |
|
|
204
205
|
| `translations` | boolean, `false` | Set translation preferences and, unless true, disable translation feature IDs. |
|
|
@@ -207,6 +208,7 @@ local configuration.
|
|
|
207
208
|
| `preferences` | object, `{}` | Dotted JSON preference overrides applied after generated preference defaults. |
|
|
208
209
|
| `connect_timeout_ms` | number, `15000` | Timeout for each discovery, launch-readiness or socket-opening wait; not one combined deadline. |
|
|
209
210
|
| `request_timeout_ms` | number, `30000` | Default timeout for each protocol request on this browser's socket. |
|
|
211
|
+
| `waitForDebuggerOnStart` | boolean, `false` | Ask Chromium to pause newly auto-attached targets. Applied to `Target.setAutoAttach` when connecting; not a CLI argument or target option. |
|
|
210
212
|
| `websocket_url` | string, unset | Attach directly to a browser WebSocket endpoint. |
|
|
211
213
|
| `http_url` | string, unset | Discover the endpoint from an HTTP(S) base URL or exact `/json/version` URL. |
|
|
212
214
|
| `port` | number, unset | Discover an existing browser at `http://<host>:<port>/json/version`. |
|
|
@@ -534,8 +536,35 @@ Domain options set to false skip setup commands; they do not actively disable a
|
|
|
534
536
|
domain already enabled by another caller. Likewise, `binding: false` does not
|
|
535
537
|
remove a previously installed binding. Use native CDP commands for immediate
|
|
536
538
|
changes. `initialize: false` skips binding installation too;
|
|
537
|
-
`Runtime.runIfWaitingForDebugger` is still sent at the end.
|
|
538
|
-
`waitForDebuggerOnStart
|
|
539
|
+
`Runtime.runIfWaitingForDebugger` is still sent at the end. The browser option
|
|
540
|
+
`waitForDebuggerOnStart` defaults to `false`. With `true`, auto-attachment requests
|
|
541
|
+
a pause. Bootstrap setup sends `Runtime.disable` before the resume command.
|
|
542
|
+
To ensure setup completes before navigating, keep the initial `about:blank` and
|
|
543
|
+
use `Page.navigate` afterward, as below. The pause flag alone does not guarantee
|
|
544
|
+
that a URL supplied through `create_params.url` waits for setup; Chromium can
|
|
545
|
+
execute that navigation's scripts during initialization.
|
|
546
|
+
|
|
547
|
+
Set this option in constructor browser defaults or in `params.browser`:
|
|
548
|
+
|
|
549
|
+
```js
|
|
550
|
+
await client.call({
|
|
551
|
+
method: 'Page.navigate',
|
|
552
|
+
params: {
|
|
553
|
+
browser: {
|
|
554
|
+
name: 'paused',
|
|
555
|
+
waitForDebuggerOnStart: true,
|
|
556
|
+
},
|
|
557
|
+
target: 'page',
|
|
558
|
+
url: 'https://example.com/',
|
|
559
|
+
},
|
|
560
|
+
})
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
The setting affects auto-attachment across that browser connection. Only targets
|
|
564
|
+
selected through `params.target` receive setup and automatic resume. Other newly
|
|
565
|
+
auto-attached tabs can remain paused: select their physical ID using
|
|
566
|
+
`params.target.targetId`, or send `Runtime.runIfWaitingForDebugger` through the
|
|
567
|
+
browser socket with their `sessionId`.
|
|
539
568
|
|
|
540
569
|
Setup CDP errors are collected as strings in `target.setup_errors`, allowing the
|
|
541
570
|
sequence to continue when a browser/target does not support a setup command.
|
|
@@ -822,8 +851,8 @@ workflow for detecting new conversations and extracting connector session handle
|
|
|
822
851
|
from tool-call history. It is a caller-side recipe, not additional library API.
|
|
823
852
|
|
|
824
853
|
For npm packaging, account setup, and GitHub publishing, see
|
|
825
|
-
[Publishing](npm/PUBLISHING.md). `
|
|
826
|
-
`
|
|
854
|
+
[Publishing](npm/PUBLISHING.md). Publishing only copies `cdp.js` and this README
|
|
855
|
+
into `npm/` alongside its manifest; no build script is needed.
|
|
827
856
|
|
|
828
857
|
```sh
|
|
829
858
|
node --check cdp.js
|
package/cdp.js
CHANGED
|
@@ -209,7 +209,7 @@ export class browser {
|
|
|
209
209
|
...options.preferences,
|
|
210
210
|
})
|
|
211
211
|
const proc = child_process.spawn(options.executable_path || browser.find_executable_path(), [...util.args_to_strings(args), 'about:blank'], {
|
|
212
|
-
windowsHide: true,
|
|
212
|
+
windowsHide: options.windowsHide ?? true,
|
|
213
213
|
stdio: ['ignore', 'ignore', 'pipe'],
|
|
214
214
|
})
|
|
215
215
|
let diagnostic = ''
|
|
@@ -386,7 +386,7 @@ export class cdp extends EventTarget {
|
|
|
386
386
|
params: {
|
|
387
387
|
autoAttach: true,
|
|
388
388
|
flatten: true,
|
|
389
|
-
waitForDebuggerOnStart: false,
|
|
389
|
+
waitForDebuggerOnStart: record.waitForDebuggerOnStart ?? false,
|
|
390
390
|
},
|
|
391
391
|
})
|
|
392
392
|
await socket.req({
|