browser-pilot 0.0.7 → 0.0.8
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/dist/actions.cjs +20 -3
- package/dist/actions.d.cts +4 -4
- package/dist/actions.d.ts +4 -4
- package/dist/actions.mjs +1 -1
- package/dist/browser.cjs +357 -34
- package/dist/browser.d.cts +7 -3
- package/dist/browser.d.ts +7 -3
- package/dist/browser.mjs +6 -5
- package/dist/{chunk-PCNEJAJ7.mjs → chunk-JN44FHTK.mjs} +331 -36
- package/dist/{chunk-6RB3GKQP.mjs → chunk-ZTQ37YQT.mjs} +35 -3
- package/dist/cli.cjs +1654 -69
- package/dist/cli.mjs +1292 -28
- package/dist/index.cjs +357 -34
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +5 -5
- package/dist/{types-TVlTA7nH.d.cts → types-DklIxnbO.d.cts} +37 -3
- package/dist/{types-CbdmaocU.d.ts → types-Pv8KzZ6l.d.ts} +37 -3
- package/package.json +1 -1
|
@@ -189,9 +189,25 @@ interface InteractiveElement {
|
|
|
189
189
|
/** Whether the element is disabled */
|
|
190
190
|
disabled?: boolean;
|
|
191
191
|
}
|
|
192
|
+
interface FailureHint {
|
|
193
|
+
/** Suggested selector */
|
|
194
|
+
selector: string;
|
|
195
|
+
/** Why this might work */
|
|
196
|
+
reason: string;
|
|
197
|
+
/** Confidence level */
|
|
198
|
+
confidence: 'high' | 'medium' | 'low';
|
|
199
|
+
/** Element info */
|
|
200
|
+
element: {
|
|
201
|
+
ref: string;
|
|
202
|
+
role: string;
|
|
203
|
+
name: string;
|
|
204
|
+
disabled?: boolean;
|
|
205
|
+
};
|
|
206
|
+
}
|
|
192
207
|
declare class ElementNotFoundError extends Error {
|
|
193
208
|
selectors: string[];
|
|
194
|
-
|
|
209
|
+
hints?: FailureHint[];
|
|
210
|
+
constructor(selectors: string | string[], hints?: FailureHint[]);
|
|
195
211
|
}
|
|
196
212
|
declare class TimeoutError extends Error {
|
|
197
213
|
constructor(message?: string);
|
|
@@ -466,6 +482,7 @@ interface ClearCookiesOptions {
|
|
|
466
482
|
|
|
467
483
|
declare class Page {
|
|
468
484
|
private cdp;
|
|
485
|
+
private _targetId;
|
|
469
486
|
private rootNodeId;
|
|
470
487
|
private batchExecutor;
|
|
471
488
|
private emulationState;
|
|
@@ -484,12 +501,23 @@ declare class Page {
|
|
|
484
501
|
private frameExecutionContexts;
|
|
485
502
|
/** Current frame's execution context ID (null = main frame default) */
|
|
486
503
|
private currentFrameContextId;
|
|
487
|
-
|
|
504
|
+
/** Last matched selector from findElement (for selectorUsed tracking) */
|
|
505
|
+
private _lastMatchedSelector;
|
|
506
|
+
constructor(cdp: CDPClient, targetId: string);
|
|
507
|
+
/**
|
|
508
|
+
* Get the CDP target ID for this page
|
|
509
|
+
*/
|
|
510
|
+
get targetId(): string;
|
|
488
511
|
/**
|
|
489
512
|
* Get the underlying CDP client for advanced operations.
|
|
490
513
|
* Use with caution - prefer high-level Page methods when possible.
|
|
491
514
|
*/
|
|
492
515
|
get cdpClient(): CDPClient;
|
|
516
|
+
/**
|
|
517
|
+
* Get the last matched selector from findElement (for selectorUsed tracking).
|
|
518
|
+
* Returns undefined if no selector has been matched yet.
|
|
519
|
+
*/
|
|
520
|
+
getLastMatchedSelector(): string | undefined;
|
|
493
521
|
/**
|
|
494
522
|
* Initialize the page (enable required CDP domains)
|
|
495
523
|
*/
|
|
@@ -557,6 +585,9 @@ declare class Page {
|
|
|
557
585
|
* - 'auto' (default): Attempt to detect navigation for 1 second, then assume client-side handling
|
|
558
586
|
* - true: Wait for full navigation (traditional forms)
|
|
559
587
|
* - false: Return immediately (AJAX forms where you'll wait for something else)
|
|
588
|
+
*
|
|
589
|
+
* When targeting a <form> element directly, uses form.requestSubmit() which fires
|
|
590
|
+
* the submit event and triggers HTML5 validation.
|
|
560
591
|
*/
|
|
561
592
|
submit(selector: string | string[], options?: SubmitOptions): Promise<boolean>;
|
|
562
593
|
/**
|
|
@@ -851,6 +882,7 @@ declare class Page {
|
|
|
851
882
|
/**
|
|
852
883
|
* Action/Step types for batch execution
|
|
853
884
|
*/
|
|
885
|
+
|
|
854
886
|
type ActionType = 'goto' | 'click' | 'fill' | 'type' | 'select' | 'check' | 'uncheck' | 'submit' | 'press' | 'focus' | 'hover' | 'scroll' | 'wait' | 'snapshot' | 'screenshot' | 'evaluate' | 'text' | 'switchFrame' | 'switchToMain';
|
|
855
887
|
interface Step {
|
|
856
888
|
/** Action type */
|
|
@@ -927,6 +959,8 @@ interface StepResult {
|
|
|
927
959
|
result?: unknown;
|
|
928
960
|
/** Text content (for text action) */
|
|
929
961
|
text?: string;
|
|
962
|
+
/** Failure hints when element not found */
|
|
963
|
+
hints?: FailureHint[];
|
|
930
964
|
}
|
|
931
965
|
interface BatchResult {
|
|
932
966
|
/** Whether all steps succeeded */
|
|
@@ -939,4 +973,4 @@ interface BatchResult {
|
|
|
939
973
|
totalDurationMs: number;
|
|
940
974
|
}
|
|
941
975
|
|
|
942
|
-
export { type WaitResult as $, type ActionType as A, type BatchOptions as B, type ConsoleHandler as C, type Dialog as D, type ElementInfo as E, type FileInput as F, type GeolocationOptions as G, type FailRequestOptions as H, type InteractiveElement as I, type FulfillRequestOptions as J, type InterceptedRequest as K, type RequestActions as L, type ResourceType as M, NavigationError as N, type RouteOptions as O, Page as P, type ClearCookiesOptions as Q, type RequestPattern as R, type Step as S, TimeoutError as T, type UserAgentMetadata as U, type ViewportOptions as V, type WaitForOptions as W, type Cookie as X, type DeleteCookieOptions as Y, type SetCookieOptions as Z, type WaitOptions as _, type RequestHandler as a, type WaitState as a0, waitForAnyElement as a1, waitForElement as a2, waitForNavigation as a3, waitForNetworkIdle as a4, type BatchResult as b, type StepResult as c, type ActionOptions as d, type ActionResult as e, type ConsoleMessage as f, type ConsoleMessageType as g, type CustomSelectConfig as h, type DialogHandler as i, type DialogType as j, type Download as k, ElementNotFoundError as l, type EmulationState as m, type ErrorHandler as n, type FillOptions as o, type NetworkIdleOptions as p, type PageError as q, type PageSnapshot as r, type SnapshotNode as s, type SubmitOptions as t, type TypeOptions as u, type UserAgentOptions as v, type DeviceDescriptor as w, type DeviceName as x, devices as y, type ContinueRequestOptions as z };
|
|
976
|
+
export { type WaitResult as $, type ActionType as A, type BatchOptions as B, type ConsoleHandler as C, type Dialog as D, type ElementInfo as E, type FileInput as F, type GeolocationOptions as G, type FailRequestOptions as H, type InteractiveElement as I, type FulfillRequestOptions as J, type InterceptedRequest as K, type RequestActions as L, type ResourceType as M, NavigationError as N, type RouteOptions as O, Page as P, type ClearCookiesOptions as Q, type RequestPattern as R, type Step as S, TimeoutError as T, type UserAgentMetadata as U, type ViewportOptions as V, type WaitForOptions as W, type Cookie as X, type DeleteCookieOptions as Y, type SetCookieOptions as Z, type WaitOptions as _, type RequestHandler as a, type WaitState as a0, waitForAnyElement as a1, waitForElement as a2, waitForNavigation as a3, waitForNetworkIdle as a4, type FailureHint as a5, type BatchResult as b, type StepResult as c, type ActionOptions as d, type ActionResult as e, type ConsoleMessage as f, type ConsoleMessageType as g, type CustomSelectConfig as h, type DialogHandler as i, type DialogType as j, type Download as k, ElementNotFoundError as l, type EmulationState as m, type ErrorHandler as n, type FillOptions as o, type NetworkIdleOptions as p, type PageError as q, type PageSnapshot as r, type SnapshotNode as s, type SubmitOptions as t, type TypeOptions as u, type UserAgentOptions as v, type DeviceDescriptor as w, type DeviceName as x, devices as y, type ContinueRequestOptions as z };
|
|
@@ -189,9 +189,25 @@ interface InteractiveElement {
|
|
|
189
189
|
/** Whether the element is disabled */
|
|
190
190
|
disabled?: boolean;
|
|
191
191
|
}
|
|
192
|
+
interface FailureHint {
|
|
193
|
+
/** Suggested selector */
|
|
194
|
+
selector: string;
|
|
195
|
+
/** Why this might work */
|
|
196
|
+
reason: string;
|
|
197
|
+
/** Confidence level */
|
|
198
|
+
confidence: 'high' | 'medium' | 'low';
|
|
199
|
+
/** Element info */
|
|
200
|
+
element: {
|
|
201
|
+
ref: string;
|
|
202
|
+
role: string;
|
|
203
|
+
name: string;
|
|
204
|
+
disabled?: boolean;
|
|
205
|
+
};
|
|
206
|
+
}
|
|
192
207
|
declare class ElementNotFoundError extends Error {
|
|
193
208
|
selectors: string[];
|
|
194
|
-
|
|
209
|
+
hints?: FailureHint[];
|
|
210
|
+
constructor(selectors: string | string[], hints?: FailureHint[]);
|
|
195
211
|
}
|
|
196
212
|
declare class TimeoutError extends Error {
|
|
197
213
|
constructor(message?: string);
|
|
@@ -466,6 +482,7 @@ interface ClearCookiesOptions {
|
|
|
466
482
|
|
|
467
483
|
declare class Page {
|
|
468
484
|
private cdp;
|
|
485
|
+
private _targetId;
|
|
469
486
|
private rootNodeId;
|
|
470
487
|
private batchExecutor;
|
|
471
488
|
private emulationState;
|
|
@@ -484,12 +501,23 @@ declare class Page {
|
|
|
484
501
|
private frameExecutionContexts;
|
|
485
502
|
/** Current frame's execution context ID (null = main frame default) */
|
|
486
503
|
private currentFrameContextId;
|
|
487
|
-
|
|
504
|
+
/** Last matched selector from findElement (for selectorUsed tracking) */
|
|
505
|
+
private _lastMatchedSelector;
|
|
506
|
+
constructor(cdp: CDPClient, targetId: string);
|
|
507
|
+
/**
|
|
508
|
+
* Get the CDP target ID for this page
|
|
509
|
+
*/
|
|
510
|
+
get targetId(): string;
|
|
488
511
|
/**
|
|
489
512
|
* Get the underlying CDP client for advanced operations.
|
|
490
513
|
* Use with caution - prefer high-level Page methods when possible.
|
|
491
514
|
*/
|
|
492
515
|
get cdpClient(): CDPClient;
|
|
516
|
+
/**
|
|
517
|
+
* Get the last matched selector from findElement (for selectorUsed tracking).
|
|
518
|
+
* Returns undefined if no selector has been matched yet.
|
|
519
|
+
*/
|
|
520
|
+
getLastMatchedSelector(): string | undefined;
|
|
493
521
|
/**
|
|
494
522
|
* Initialize the page (enable required CDP domains)
|
|
495
523
|
*/
|
|
@@ -557,6 +585,9 @@ declare class Page {
|
|
|
557
585
|
* - 'auto' (default): Attempt to detect navigation for 1 second, then assume client-side handling
|
|
558
586
|
* - true: Wait for full navigation (traditional forms)
|
|
559
587
|
* - false: Return immediately (AJAX forms where you'll wait for something else)
|
|
588
|
+
*
|
|
589
|
+
* When targeting a <form> element directly, uses form.requestSubmit() which fires
|
|
590
|
+
* the submit event and triggers HTML5 validation.
|
|
560
591
|
*/
|
|
561
592
|
submit(selector: string | string[], options?: SubmitOptions): Promise<boolean>;
|
|
562
593
|
/**
|
|
@@ -851,6 +882,7 @@ declare class Page {
|
|
|
851
882
|
/**
|
|
852
883
|
* Action/Step types for batch execution
|
|
853
884
|
*/
|
|
885
|
+
|
|
854
886
|
type ActionType = 'goto' | 'click' | 'fill' | 'type' | 'select' | 'check' | 'uncheck' | 'submit' | 'press' | 'focus' | 'hover' | 'scroll' | 'wait' | 'snapshot' | 'screenshot' | 'evaluate' | 'text' | 'switchFrame' | 'switchToMain';
|
|
855
887
|
interface Step {
|
|
856
888
|
/** Action type */
|
|
@@ -927,6 +959,8 @@ interface StepResult {
|
|
|
927
959
|
result?: unknown;
|
|
928
960
|
/** Text content (for text action) */
|
|
929
961
|
text?: string;
|
|
962
|
+
/** Failure hints when element not found */
|
|
963
|
+
hints?: FailureHint[];
|
|
930
964
|
}
|
|
931
965
|
interface BatchResult {
|
|
932
966
|
/** Whether all steps succeeded */
|
|
@@ -939,4 +973,4 @@ interface BatchResult {
|
|
|
939
973
|
totalDurationMs: number;
|
|
940
974
|
}
|
|
941
975
|
|
|
942
|
-
export { type WaitResult as $, type ActionType as A, type BatchOptions as B, type ConsoleHandler as C, type Dialog as D, type ElementInfo as E, type FileInput as F, type GeolocationOptions as G, type FailRequestOptions as H, type InteractiveElement as I, type FulfillRequestOptions as J, type InterceptedRequest as K, type RequestActions as L, type ResourceType as M, NavigationError as N, type RouteOptions as O, Page as P, type ClearCookiesOptions as Q, type RequestPattern as R, type Step as S, TimeoutError as T, type UserAgentMetadata as U, type ViewportOptions as V, type WaitForOptions as W, type Cookie as X, type DeleteCookieOptions as Y, type SetCookieOptions as Z, type WaitOptions as _, type RequestHandler as a, type WaitState as a0, waitForAnyElement as a1, waitForElement as a2, waitForNavigation as a3, waitForNetworkIdle as a4, type BatchResult as b, type StepResult as c, type ActionOptions as d, type ActionResult as e, type ConsoleMessage as f, type ConsoleMessageType as g, type CustomSelectConfig as h, type DialogHandler as i, type DialogType as j, type Download as k, ElementNotFoundError as l, type EmulationState as m, type ErrorHandler as n, type FillOptions as o, type NetworkIdleOptions as p, type PageError as q, type PageSnapshot as r, type SnapshotNode as s, type SubmitOptions as t, type TypeOptions as u, type UserAgentOptions as v, type DeviceDescriptor as w, type DeviceName as x, devices as y, type ContinueRequestOptions as z };
|
|
976
|
+
export { type WaitResult as $, type ActionType as A, type BatchOptions as B, type ConsoleHandler as C, type Dialog as D, type ElementInfo as E, type FileInput as F, type GeolocationOptions as G, type FailRequestOptions as H, type InteractiveElement as I, type FulfillRequestOptions as J, type InterceptedRequest as K, type RequestActions as L, type ResourceType as M, NavigationError as N, type RouteOptions as O, Page as P, type ClearCookiesOptions as Q, type RequestPattern as R, type Step as S, TimeoutError as T, type UserAgentMetadata as U, type ViewportOptions as V, type WaitForOptions as W, type Cookie as X, type DeleteCookieOptions as Y, type SetCookieOptions as Z, type WaitOptions as _, type RequestHandler as a, type WaitState as a0, waitForAnyElement as a1, waitForElement as a2, waitForNavigation as a3, waitForNetworkIdle as a4, type FailureHint as a5, type BatchResult as b, type StepResult as c, type ActionOptions as d, type ActionResult as e, type ConsoleMessage as f, type ConsoleMessageType as g, type CustomSelectConfig as h, type DialogHandler as i, type DialogType as j, type Download as k, ElementNotFoundError as l, type EmulationState as m, type ErrorHandler as n, type FillOptions as o, type NetworkIdleOptions as p, type PageError as q, type PageSnapshot as r, type SnapshotNode as s, type SubmitOptions as t, type TypeOptions as u, type UserAgentOptions as v, type DeviceDescriptor as w, type DeviceName as x, devices as y, type ContinueRequestOptions as z };
|