browser-pilot 0.0.11 → 0.0.13
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 +44 -8
- package/dist/actions.cjs +686 -32
- package/dist/actions.d.cts +3 -3
- package/dist/actions.d.ts +3 -3
- package/dist/actions.mjs +2 -1
- package/dist/browser.cjs +3415 -2324
- package/dist/browser.d.cts +9 -3
- package/dist/browser.d.ts +9 -3
- package/dist/browser.mjs +4 -3
- package/dist/cdp.cjs +19 -4
- package/dist/cdp.d.cts +1 -1
- package/dist/cdp.d.ts +1 -1
- package/dist/cdp.mjs +4 -2
- package/dist/chunk-A2ZRAEO3.mjs +1711 -0
- package/dist/{chunk-BCOZUKWS.mjs → chunk-HP6R3W32.mjs} +22 -16
- package/dist/chunk-JXAUPHZM.mjs +15 -0
- package/dist/{chunk-JHAF52FA.mjs → chunk-VDAMDOS6.mjs} +1014 -738
- package/dist/cli.mjs +4998 -3259
- package/dist/{client-7Nqka5MV.d.ts → client-DRqxBdHv.d.cts} +1 -1
- package/dist/{client-7Nqka5MV.d.cts → client-DRqxBdHv.d.ts} +1 -1
- package/dist/index.cjs +4555 -3314
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +6 -4
- package/dist/{types-GWuQJs_e.d.cts → types-BXMGFtnB.d.cts} +96 -9
- package/dist/{types-DtGF3yGl.d.ts → types-CzgQjai9.d.ts} +96 -9
- package/package.json +6 -2
- package/dist/chunk-FAUNIZR7.mjs +0 -751
package/dist/browser.d.cts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { C as CDPClient } from './client-
|
|
1
|
+
import { C as CDPClient } from './client-DRqxBdHv.cjs';
|
|
2
|
+
import { TargetInfo } from './cdp.cjs';
|
|
2
3
|
import { b as ConnectOptions } from './types--wXNHUwt.cjs';
|
|
3
|
-
import {
|
|
4
|
-
export { k as ActionOptions, l as ActionResult, m as ConsoleHandler, n as ConsoleMessage, o as ConsoleMessageType, p as CustomSelectConfig, D as Dialog, q as DialogHandler, r as DialogType, s as Download, E as ElementInfo, t as ElementNotFoundError, u as EmulationState, v as ErrorHandler,
|
|
4
|
+
import { H as Page } from './types-BXMGFtnB.cjs';
|
|
5
|
+
export { k as ActionOptions, l as ActionResult, m as ConsoleHandler, n as ConsoleMessage, o as ConsoleMessageType, p as CustomSelectConfig, D as Dialog, q as DialogHandler, r as DialogType, s as Download, E as ElementInfo, t as ElementNotFoundError, u as EmulationState, v as ErrorHandler, ah as FailureHint, F as FileInput, w as FillOptions, x as FormField, y as FormOption, G as GeolocationOptions, I as InteractiveElement, N as NavigationError, z as NetworkIdleOptions, J as PageError, K as PageSnapshot, L as SnapshotNode, M as SnapshotOptions, O as SubmitOptions, T as TimeoutError, Q as TypeOptions, U as UserAgentMetadata, V as UserAgentOptions, W as ViewportOptions, X as WaitForOptions } from './types-BXMGFtnB.cjs';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Browser class - manages CDP connection and pages
|
|
@@ -31,6 +32,7 @@ declare class Browser {
|
|
|
31
32
|
private cdp;
|
|
32
33
|
private providerSession;
|
|
33
34
|
private pages;
|
|
35
|
+
private pageCounter;
|
|
34
36
|
private constructor();
|
|
35
37
|
/**
|
|
36
38
|
* Connect to a browser instance
|
|
@@ -54,6 +56,10 @@ declare class Browser {
|
|
|
54
56
|
* Close a page by name
|
|
55
57
|
*/
|
|
56
58
|
closePage(name: string): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* List all page targets in the connected browser.
|
|
61
|
+
*/
|
|
62
|
+
listTargets(): Promise<TargetInfo[]>;
|
|
57
63
|
/**
|
|
58
64
|
* Get the WebSocket URL for this browser connection
|
|
59
65
|
*/
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { C as CDPClient } from './client-
|
|
1
|
+
import { C as CDPClient } from './client-DRqxBdHv.js';
|
|
2
|
+
import { TargetInfo } from './cdp.js';
|
|
2
3
|
import { b as ConnectOptions } from './types--wXNHUwt.js';
|
|
3
|
-
import {
|
|
4
|
-
export { k as ActionOptions, l as ActionResult, m as ConsoleHandler, n as ConsoleMessage, o as ConsoleMessageType, p as CustomSelectConfig, D as Dialog, q as DialogHandler, r as DialogType, s as Download, E as ElementInfo, t as ElementNotFoundError, u as EmulationState, v as ErrorHandler,
|
|
4
|
+
import { H as Page } from './types-CzgQjai9.js';
|
|
5
|
+
export { k as ActionOptions, l as ActionResult, m as ConsoleHandler, n as ConsoleMessage, o as ConsoleMessageType, p as CustomSelectConfig, D as Dialog, q as DialogHandler, r as DialogType, s as Download, E as ElementInfo, t as ElementNotFoundError, u as EmulationState, v as ErrorHandler, ah as FailureHint, F as FileInput, w as FillOptions, x as FormField, y as FormOption, G as GeolocationOptions, I as InteractiveElement, N as NavigationError, z as NetworkIdleOptions, J as PageError, K as PageSnapshot, L as SnapshotNode, M as SnapshotOptions, O as SubmitOptions, T as TimeoutError, Q as TypeOptions, U as UserAgentMetadata, V as UserAgentOptions, W as ViewportOptions, X as WaitForOptions } from './types-CzgQjai9.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Browser class - manages CDP connection and pages
|
|
@@ -31,6 +32,7 @@ declare class Browser {
|
|
|
31
32
|
private cdp;
|
|
32
33
|
private providerSession;
|
|
33
34
|
private pages;
|
|
35
|
+
private pageCounter;
|
|
34
36
|
private constructor();
|
|
35
37
|
/**
|
|
36
38
|
* Connect to a browser instance
|
|
@@ -54,6 +56,10 @@ declare class Browser {
|
|
|
54
56
|
* Close a page by name
|
|
55
57
|
*/
|
|
56
58
|
closePage(name: string): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* List all page targets in the connected browser.
|
|
61
|
+
*/
|
|
62
|
+
listTargets(): Promise<TargetInfo[]>;
|
|
57
63
|
/**
|
|
58
64
|
* Get the WebSocket URL for this browser connection
|
|
59
65
|
*/
|
package/dist/browser.mjs
CHANGED
|
@@ -2,14 +2,15 @@ import {
|
|
|
2
2
|
Browser,
|
|
3
3
|
Page,
|
|
4
4
|
connect
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-VDAMDOS6.mjs";
|
|
6
|
+
import "./chunk-HP6R3W32.mjs";
|
|
7
7
|
import "./chunk-BRAFQUMG.mjs";
|
|
8
8
|
import {
|
|
9
9
|
ElementNotFoundError,
|
|
10
10
|
NavigationError,
|
|
11
11
|
TimeoutError
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-A2ZRAEO3.mjs";
|
|
13
|
+
import "./chunk-JXAUPHZM.mjs";
|
|
13
14
|
export {
|
|
14
15
|
Browser,
|
|
15
16
|
ElementNotFoundError,
|
package/dist/cdp.cjs
CHANGED
|
@@ -67,13 +67,28 @@ function createTransport(wsUrl, options = {}) {
|
|
|
67
67
|
resolveClose();
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
let settled = false;
|
|
71
|
+
let fallbackTimer;
|
|
72
|
+
const finish = () => {
|
|
73
|
+
if (settled) return;
|
|
74
|
+
settled = true;
|
|
75
|
+
if (fallbackTimer) clearTimeout(fallbackTimer);
|
|
71
76
|
ws.removeEventListener("close", onClose);
|
|
72
77
|
resolveClose();
|
|
73
78
|
};
|
|
79
|
+
const onClose = () => {
|
|
80
|
+
finish();
|
|
81
|
+
};
|
|
74
82
|
ws.addEventListener("close", onClose);
|
|
75
|
-
|
|
76
|
-
|
|
83
|
+
try {
|
|
84
|
+
if (ws.readyState === WebSocket.OPEN || ws.readyState === WebSocket.CONNECTING) {
|
|
85
|
+
ws.close();
|
|
86
|
+
}
|
|
87
|
+
} catch {
|
|
88
|
+
finish();
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
fallbackTimer = setTimeout(finish, 200);
|
|
77
92
|
});
|
|
78
93
|
},
|
|
79
94
|
onMessage(handler) {
|
|
@@ -198,7 +213,7 @@ async function createCDPClient(wsUrl, options = {}) {
|
|
|
198
213
|
throw new Error("CDP client is not connected");
|
|
199
214
|
}
|
|
200
215
|
const id = ++messageId;
|
|
201
|
-
const effectiveSessionId = sessionId ?? currentSessionId;
|
|
216
|
+
const effectiveSessionId = sessionId === null ? void 0 : sessionId ?? currentSessionId;
|
|
202
217
|
const request = { id, method };
|
|
203
218
|
if (params !== void 0) {
|
|
204
219
|
request.params = params;
|
package/dist/cdp.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { C as CDPClient, a as CDPClientOptions, T as Transport, d as TransportOptions, c as createCDPClient, b as createTransport } from './client-
|
|
1
|
+
export { C as CDPClient, a as CDPClientOptions, T as Transport, d as TransportOptions, c as createCDPClient, b as createTransport } from './client-DRqxBdHv.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* CDP Protocol type definitions
|
package/dist/cdp.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { C as CDPClient, a as CDPClientOptions, T as Transport, d as TransportOptions, c as createCDPClient, b as createTransport } from './client-
|
|
1
|
+
export { C as CDPClient, a as CDPClientOptions, T as Transport, d as TransportOptions, c as createCDPClient, b as createTransport } from './client-DRqxBdHv.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* CDP Protocol type definitions
|