browser-pilot 0.0.4 → 0.0.6
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 +39 -0
- package/dist/actions.cjs +2 -1
- package/dist/actions.d.cts +2 -2
- package/dist/actions.d.ts +2 -2
- package/dist/actions.mjs +1 -1
- package/dist/browser.cjs +26 -4
- package/dist/browser.d.cts +2 -2
- package/dist/browser.d.ts +2 -2
- package/dist/browser.mjs +2 -2
- package/dist/{chunk-YEHK2XY3.mjs → chunk-6RB3GKQP.mjs} +2 -1
- package/dist/{chunk-CWSTSVWO.mjs → chunk-PCNEJAJ7.mjs} +25 -4
- package/dist/cli.cjs +948 -88
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.mjs +842 -4
- package/dist/index.cjs +26 -4
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/{types-BJv2dzu0.d.ts → types-CbdmaocU.d.ts} +9 -0
- package/dist/{types-C6m0bT04.d.cts → types-TVlTA7nH.d.cts} +9 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -134,7 +134,8 @@ var BatchExecutor = class {
|
|
|
134
134
|
await this.page.fill(step.selector, step.value, {
|
|
135
135
|
timeout,
|
|
136
136
|
optional,
|
|
137
|
-
clear: step.clear ?? true
|
|
137
|
+
clear: step.clear ?? true,
|
|
138
|
+
blur: step.blur
|
|
138
139
|
});
|
|
139
140
|
return { selectorUsed: this.getUsedSelector(step.selector) };
|
|
140
141
|
}
|
|
@@ -1203,6 +1204,13 @@ var Page = class {
|
|
|
1203
1204
|
this.cdp = cdp;
|
|
1204
1205
|
this.batchExecutor = new BatchExecutor(this);
|
|
1205
1206
|
}
|
|
1207
|
+
/**
|
|
1208
|
+
* Get the underlying CDP client for advanced operations.
|
|
1209
|
+
* Use with caution - prefer high-level Page methods when possible.
|
|
1210
|
+
*/
|
|
1211
|
+
get cdpClient() {
|
|
1212
|
+
return this.cdp;
|
|
1213
|
+
}
|
|
1206
1214
|
/**
|
|
1207
1215
|
* Initialize the page (enable required CDP domains)
|
|
1208
1216
|
*/
|
|
@@ -1353,7 +1361,7 @@ var Page = class {
|
|
|
1353
1361
|
* Fill an input field (clears first by default)
|
|
1354
1362
|
*/
|
|
1355
1363
|
async fill(selector, value, options = {}) {
|
|
1356
|
-
const { clear = true } = options;
|
|
1364
|
+
const { clear = true, blur = false } = options;
|
|
1357
1365
|
return this.withStaleNodeRetry(async () => {
|
|
1358
1366
|
const element = await this.findElement(selector, options);
|
|
1359
1367
|
if (!element) {
|
|
@@ -1367,7 +1375,11 @@ var Page = class {
|
|
|
1367
1375
|
const el = document.querySelector(${JSON.stringify(element.selector)});
|
|
1368
1376
|
if (el) {
|
|
1369
1377
|
el.value = '';
|
|
1370
|
-
el.dispatchEvent(new
|
|
1378
|
+
el.dispatchEvent(new InputEvent('input', {
|
|
1379
|
+
bubbles: true,
|
|
1380
|
+
cancelable: true,
|
|
1381
|
+
inputType: 'deleteContent'
|
|
1382
|
+
}));
|
|
1371
1383
|
}
|
|
1372
1384
|
})()`
|
|
1373
1385
|
);
|
|
@@ -1377,11 +1389,21 @@ var Page = class {
|
|
|
1377
1389
|
`(() => {
|
|
1378
1390
|
const el = document.querySelector(${JSON.stringify(element.selector)});
|
|
1379
1391
|
if (el) {
|
|
1380
|
-
el.dispatchEvent(new
|
|
1392
|
+
el.dispatchEvent(new InputEvent('input', {
|
|
1393
|
+
bubbles: true,
|
|
1394
|
+
cancelable: true,
|
|
1395
|
+
inputType: 'insertText',
|
|
1396
|
+
data: ${JSON.stringify(value)}
|
|
1397
|
+
}));
|
|
1381
1398
|
el.dispatchEvent(new Event('change', { bubbles: true }));
|
|
1382
1399
|
}
|
|
1383
1400
|
})()`
|
|
1384
1401
|
);
|
|
1402
|
+
if (blur) {
|
|
1403
|
+
await this.evaluateInFrame(
|
|
1404
|
+
`document.querySelector(${JSON.stringify(element.selector)})?.blur()`
|
|
1405
|
+
);
|
|
1406
|
+
}
|
|
1385
1407
|
return true;
|
|
1386
1408
|
});
|
|
1387
1409
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { BatchExecutor, addBatchToPage } from './actions.cjs';
|
|
2
|
-
import { R as RequestPattern, a as RequestHandler } from './types-
|
|
3
|
-
export { d as ActionOptions, e as ActionResult, A as ActionType, B as BatchOptions, b as BatchResult, Q as ClearCookiesOptions, C as ConsoleHandler, f as ConsoleMessage, g as ConsoleMessageType, z as ContinueRequestOptions, X as Cookie, h as CustomSelectConfig, Y as DeleteCookieOptions, w as DeviceDescriptor, x as DeviceName, D as Dialog, i as DialogHandler, j as DialogType, k as Download, E as ElementInfo, l as ElementNotFoundError, m as EmulationState, n as ErrorHandler, H as FailRequestOptions, F as FileInput, o as FillOptions, J as FulfillRequestOptions, G as GeolocationOptions, I as InteractiveElement, K as InterceptedRequest, N as NavigationError, p as NetworkIdleOptions, P as Page, q as PageError, r as PageSnapshot, L as RequestActions, M as ResourceType, O as RouteOptions, Z as SetCookieOptions, s as SnapshotNode, S as Step, c as StepResult, t as SubmitOptions, T as TimeoutError, u as TypeOptions, U as UserAgentMetadata, v as UserAgentOptions, V as ViewportOptions, W as WaitForOptions, _ as WaitOptions, $ as WaitResult, a0 as WaitState, y as devices, a1 as waitForAnyElement, a2 as waitForElement, a3 as waitForNavigation, a4 as waitForNetworkIdle } from './types-
|
|
2
|
+
import { R as RequestPattern, a as RequestHandler } from './types-TVlTA7nH.cjs';
|
|
3
|
+
export { d as ActionOptions, e as ActionResult, A as ActionType, B as BatchOptions, b as BatchResult, Q as ClearCookiesOptions, C as ConsoleHandler, f as ConsoleMessage, g as ConsoleMessageType, z as ContinueRequestOptions, X as Cookie, h as CustomSelectConfig, Y as DeleteCookieOptions, w as DeviceDescriptor, x as DeviceName, D as Dialog, i as DialogHandler, j as DialogType, k as Download, E as ElementInfo, l as ElementNotFoundError, m as EmulationState, n as ErrorHandler, H as FailRequestOptions, F as FileInput, o as FillOptions, J as FulfillRequestOptions, G as GeolocationOptions, I as InteractiveElement, K as InterceptedRequest, N as NavigationError, p as NetworkIdleOptions, P as Page, q as PageError, r as PageSnapshot, L as RequestActions, M as ResourceType, O as RouteOptions, Z as SetCookieOptions, s as SnapshotNode, S as Step, c as StepResult, t as SubmitOptions, T as TimeoutError, u as TypeOptions, U as UserAgentMetadata, v as UserAgentOptions, V as ViewportOptions, W as WaitForOptions, _ as WaitOptions, $ as WaitResult, a0 as WaitState, y as devices, a1 as waitForAnyElement, a2 as waitForElement, a3 as waitForNavigation, a4 as waitForNetworkIdle } from './types-TVlTA7nH.cjs';
|
|
4
4
|
export { Browser, BrowserOptions, connect } from './browser.cjs';
|
|
5
5
|
import { C as CDPClient } from './client-7Nqka5MV.cjs';
|
|
6
6
|
export { a as CDPClientOptions, c as createCDPClient } from './client-7Nqka5MV.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { BatchExecutor, addBatchToPage } from './actions.js';
|
|
2
|
-
import { R as RequestPattern, a as RequestHandler } from './types-
|
|
3
|
-
export { d as ActionOptions, e as ActionResult, A as ActionType, B as BatchOptions, b as BatchResult, Q as ClearCookiesOptions, C as ConsoleHandler, f as ConsoleMessage, g as ConsoleMessageType, z as ContinueRequestOptions, X as Cookie, h as CustomSelectConfig, Y as DeleteCookieOptions, w as DeviceDescriptor, x as DeviceName, D as Dialog, i as DialogHandler, j as DialogType, k as Download, E as ElementInfo, l as ElementNotFoundError, m as EmulationState, n as ErrorHandler, H as FailRequestOptions, F as FileInput, o as FillOptions, J as FulfillRequestOptions, G as GeolocationOptions, I as InteractiveElement, K as InterceptedRequest, N as NavigationError, p as NetworkIdleOptions, P as Page, q as PageError, r as PageSnapshot, L as RequestActions, M as ResourceType, O as RouteOptions, Z as SetCookieOptions, s as SnapshotNode, S as Step, c as StepResult, t as SubmitOptions, T as TimeoutError, u as TypeOptions, U as UserAgentMetadata, v as UserAgentOptions, V as ViewportOptions, W as WaitForOptions, _ as WaitOptions, $ as WaitResult, a0 as WaitState, y as devices, a1 as waitForAnyElement, a2 as waitForElement, a3 as waitForNavigation, a4 as waitForNetworkIdle } from './types-
|
|
2
|
+
import { R as RequestPattern, a as RequestHandler } from './types-CbdmaocU.js';
|
|
3
|
+
export { d as ActionOptions, e as ActionResult, A as ActionType, B as BatchOptions, b as BatchResult, Q as ClearCookiesOptions, C as ConsoleHandler, f as ConsoleMessage, g as ConsoleMessageType, z as ContinueRequestOptions, X as Cookie, h as CustomSelectConfig, Y as DeleteCookieOptions, w as DeviceDescriptor, x as DeviceName, D as Dialog, i as DialogHandler, j as DialogType, k as Download, E as ElementInfo, l as ElementNotFoundError, m as EmulationState, n as ErrorHandler, H as FailRequestOptions, F as FileInput, o as FillOptions, J as FulfillRequestOptions, G as GeolocationOptions, I as InteractiveElement, K as InterceptedRequest, N as NavigationError, p as NetworkIdleOptions, P as Page, q as PageError, r as PageSnapshot, L as RequestActions, M as ResourceType, O as RouteOptions, Z as SetCookieOptions, s as SnapshotNode, S as Step, c as StepResult, t as SubmitOptions, T as TimeoutError, u as TypeOptions, U as UserAgentMetadata, v as UserAgentOptions, V as ViewportOptions, W as WaitForOptions, _ as WaitOptions, $ as WaitResult, a0 as WaitState, y as devices, a1 as waitForAnyElement, a2 as waitForElement, a3 as waitForNavigation, a4 as waitForNetworkIdle } from './types-CbdmaocU.js';
|
|
4
4
|
export { Browser, BrowserOptions, connect } from './browser.js';
|
|
5
5
|
import { C as CDPClient } from './client-7Nqka5MV.js';
|
|
6
6
|
export { a as CDPClientOptions, c as createCDPClient } from './client-7Nqka5MV.js';
|
package/dist/index.mjs
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
waitForElement,
|
|
18
18
|
waitForNavigation,
|
|
19
19
|
waitForNetworkIdle
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-PCNEJAJ7.mjs";
|
|
21
21
|
import {
|
|
22
22
|
CDPError,
|
|
23
23
|
createCDPClient
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
import {
|
|
34
34
|
BatchExecutor,
|
|
35
35
|
addBatchToPage
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-6RB3GKQP.mjs";
|
|
37
37
|
export {
|
|
38
38
|
BatchExecutor,
|
|
39
39
|
Browser,
|
|
@@ -68,6 +68,8 @@ interface ActionOptions {
|
|
|
68
68
|
interface FillOptions extends ActionOptions {
|
|
69
69
|
/** Clear existing content before filling */
|
|
70
70
|
clear?: boolean;
|
|
71
|
+
/** Trigger blur after filling (useful for React/Vue frameworks that update on blur) */
|
|
72
|
+
blur?: boolean;
|
|
71
73
|
}
|
|
72
74
|
interface TypeOptions extends ActionOptions {
|
|
73
75
|
/** Delay between keystrokes in ms */
|
|
@@ -483,6 +485,11 @@ declare class Page {
|
|
|
483
485
|
/** Current frame's execution context ID (null = main frame default) */
|
|
484
486
|
private currentFrameContextId;
|
|
485
487
|
constructor(cdp: CDPClient);
|
|
488
|
+
/**
|
|
489
|
+
* Get the underlying CDP client for advanced operations.
|
|
490
|
+
* Use with caution - prefer high-level Page methods when possible.
|
|
491
|
+
*/
|
|
492
|
+
get cdpClient(): CDPClient;
|
|
486
493
|
/**
|
|
487
494
|
* Initialize the page (enable required CDP domains)
|
|
488
495
|
*/
|
|
@@ -866,6 +873,8 @@ interface Step {
|
|
|
866
873
|
method?: 'enter' | 'click' | 'enter+click';
|
|
867
874
|
/** Clear input before filling */
|
|
868
875
|
clear?: boolean;
|
|
876
|
+
/** Trigger blur after filling (for React/Vue frameworks) */
|
|
877
|
+
blur?: boolean;
|
|
869
878
|
/** Delay between keystrokes for type action */
|
|
870
879
|
delay?: number;
|
|
871
880
|
/** Wait for navigation after click action completes */
|
|
@@ -68,6 +68,8 @@ interface ActionOptions {
|
|
|
68
68
|
interface FillOptions extends ActionOptions {
|
|
69
69
|
/** Clear existing content before filling */
|
|
70
70
|
clear?: boolean;
|
|
71
|
+
/** Trigger blur after filling (useful for React/Vue frameworks that update on blur) */
|
|
72
|
+
blur?: boolean;
|
|
71
73
|
}
|
|
72
74
|
interface TypeOptions extends ActionOptions {
|
|
73
75
|
/** Delay between keystrokes in ms */
|
|
@@ -483,6 +485,11 @@ declare class Page {
|
|
|
483
485
|
/** Current frame's execution context ID (null = main frame default) */
|
|
484
486
|
private currentFrameContextId;
|
|
485
487
|
constructor(cdp: CDPClient);
|
|
488
|
+
/**
|
|
489
|
+
* Get the underlying CDP client for advanced operations.
|
|
490
|
+
* Use with caution - prefer high-level Page methods when possible.
|
|
491
|
+
*/
|
|
492
|
+
get cdpClient(): CDPClient;
|
|
486
493
|
/**
|
|
487
494
|
* Initialize the page (enable required CDP domains)
|
|
488
495
|
*/
|
|
@@ -866,6 +873,8 @@ interface Step {
|
|
|
866
873
|
method?: 'enter' | 'click' | 'enter+click';
|
|
867
874
|
/** Clear input before filling */
|
|
868
875
|
clear?: boolean;
|
|
876
|
+
/** Trigger blur after filling (for React/Vue frameworks) */
|
|
877
|
+
blur?: boolean;
|
|
869
878
|
/** Delay between keystrokes for type action */
|
|
870
879
|
delay?: number;
|
|
871
880
|
/** Wait for navigation after click action completes */
|