browser-pilot 0.0.10 → 0.0.11
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 +16 -7
- package/dist/actions.d.cts +2 -2
- package/dist/actions.d.ts +2 -2
- package/dist/actions.mjs +1 -1
- package/dist/browser.cjs +1619 -303
- package/dist/browser.d.cts +22 -5
- package/dist/browser.d.ts +22 -5
- package/dist/browser.mjs +3 -3
- package/dist/{chunk-R3PS4PCM.mjs → chunk-BRAFQUMG.mjs} +34 -12
- package/dist/{chunk-KKW2SZLV.mjs → chunk-FAUNIZR7.mjs} +18 -8
- package/dist/{chunk-7OSR2CAE.mjs → chunk-JHAF52FA.mjs} +1611 -301
- package/dist/cli.mjs +1988 -345
- package/dist/index.cjs +1669 -327
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +3 -3
- package/dist/providers.cjs +34 -12
- package/dist/providers.mjs +1 -1
- package/dist/{types-DOGsEYQa.d.ts → types-DtGF3yGl.d.ts} +39 -11
- package/dist/{types-CYw-7vx1.d.cts → types-GWuQJs_e.d.cts} +39 -11
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { BatchExecutor, ValidationError, ValidationResult, addBatchToPage, validateSteps } from './actions.cjs';
|
|
2
|
-
import { R as RequestPattern, a as RequestHandler, C as CaptureResult } from './types-
|
|
3
|
-
export { k as ActionOptions, l as ActionResult, A as ActionType, d as AudioChunk, e as AudioInput, f as AudioInputState, g as AudioOutput, B as BatchOptions, b as BatchResult, h as CaptureOptions, a3 as ClearCookiesOptions, m as ConsoleHandler, n as ConsoleMessage, o as ConsoleMessageType, Y as ContinueRequestOptions, a4 as Cookie, p as CustomSelectConfig, a5 as DeleteCookieOptions, O as DeviceDescriptor, Q as DeviceName, D as Dialog, q as DialogHandler, r as DialogType, s as Download, E as ElementInfo, t as ElementNotFoundError, u as EmulationState, v as ErrorHandler, Z as FailRequestOptions, F as FileInput, w as FillOptions, _ as FulfillRequestOptions, G as GeolocationOptions, I as InteractiveElement, $ as InterceptedRequest, N as NavigationError, x as NetworkIdleOptions, y as Page, z as PageError, H as PageSnapshot, P as PlayOptions, a0 as RequestActions, a1 as ResourceType, i as RoundTripOptions, j as RoundTripResult, a2 as RouteOptions, a6 as SetCookieOptions, J as SnapshotNode, S as Step, c as StepResult, K as SubmitOptions, T as TimeoutError, L as TypeOptions, U as UserAgentMetadata, M as UserAgentOptions, V as ViewportOptions, W as WaitForOptions, a7 as WaitOptions, a8 as WaitResult, a9 as WaitState, X as devices, aa as waitForAnyElement, ab as waitForElement, ac as waitForNavigation, ad as waitForNetworkIdle } from './types-
|
|
2
|
+
import { R as RequestPattern, a as RequestHandler, C as CaptureResult } from './types-GWuQJs_e.cjs';
|
|
3
|
+
export { k as ActionOptions, l as ActionResult, A as ActionType, d as AudioChunk, e as AudioInput, f as AudioInputState, g as AudioOutput, B as BatchOptions, b as BatchResult, h as CaptureOptions, a3 as ClearCookiesOptions, m as ConsoleHandler, n as ConsoleMessage, o as ConsoleMessageType, Y as ContinueRequestOptions, a4 as Cookie, p as CustomSelectConfig, a5 as DeleteCookieOptions, O as DeviceDescriptor, Q as DeviceName, D as Dialog, q as DialogHandler, r as DialogType, s as Download, E as ElementInfo, t as ElementNotFoundError, u as EmulationState, v as ErrorHandler, Z as FailRequestOptions, F as FileInput, w as FillOptions, _ as FulfillRequestOptions, G as GeolocationOptions, I as InteractiveElement, $ as InterceptedRequest, N as NavigationError, x as NetworkIdleOptions, y as Page, z as PageError, H as PageSnapshot, P as PlayOptions, a0 as RequestActions, a1 as ResourceType, i as RoundTripOptions, j as RoundTripResult, a2 as RouteOptions, a6 as SetCookieOptions, J as SnapshotNode, S as Step, c as StepResult, K as SubmitOptions, T as TimeoutError, L as TypeOptions, U as UserAgentMetadata, M as UserAgentOptions, V as ViewportOptions, W as WaitForOptions, a7 as WaitOptions, a8 as WaitResult, a9 as WaitState, X as devices, aa as waitForAnyElement, ab as waitForElement, ac as waitForNavigation, ad as waitForNetworkIdle } from './types-GWuQJs_e.cjs';
|
|
4
4
|
import { C as CDPClient } from './client-7Nqka5MV.cjs';
|
|
5
5
|
export { a as CDPClientOptions, c as createCDPClient } from './client-7Nqka5MV.cjs';
|
|
6
|
-
export { Browser, BrowserOptions, connect } from './browser.cjs';
|
|
6
|
+
export { Browser, BrowserOptions, PageOptions, connect } from './browser.cjs';
|
|
7
7
|
export { CDPError } from './cdp.cjs';
|
|
8
8
|
export { BrowserBaseProvider, BrowserlessProvider, GenericProvider, createProvider, discoverTargets, getBrowserWebSocketUrl } from './providers.cjs';
|
|
9
9
|
export { b as ConnectOptions, C as CreateSessionOptions, P as Provider, a as ProviderSession } from './types--wXNHUwt.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { BatchExecutor, ValidationError, ValidationResult, addBatchToPage, validateSteps } from './actions.js';
|
|
2
|
-
import { R as RequestPattern, a as RequestHandler, C as CaptureResult } from './types-
|
|
3
|
-
export { k as ActionOptions, l as ActionResult, A as ActionType, d as AudioChunk, e as AudioInput, f as AudioInputState, g as AudioOutput, B as BatchOptions, b as BatchResult, h as CaptureOptions, a3 as ClearCookiesOptions, m as ConsoleHandler, n as ConsoleMessage, o as ConsoleMessageType, Y as ContinueRequestOptions, a4 as Cookie, p as CustomSelectConfig, a5 as DeleteCookieOptions, O as DeviceDescriptor, Q as DeviceName, D as Dialog, q as DialogHandler, r as DialogType, s as Download, E as ElementInfo, t as ElementNotFoundError, u as EmulationState, v as ErrorHandler, Z as FailRequestOptions, F as FileInput, w as FillOptions, _ as FulfillRequestOptions, G as GeolocationOptions, I as InteractiveElement, $ as InterceptedRequest, N as NavigationError, x as NetworkIdleOptions, y as Page, z as PageError, H as PageSnapshot, P as PlayOptions, a0 as RequestActions, a1 as ResourceType, i as RoundTripOptions, j as RoundTripResult, a2 as RouteOptions, a6 as SetCookieOptions, J as SnapshotNode, S as Step, c as StepResult, K as SubmitOptions, T as TimeoutError, L as TypeOptions, U as UserAgentMetadata, M as UserAgentOptions, V as ViewportOptions, W as WaitForOptions, a7 as WaitOptions, a8 as WaitResult, a9 as WaitState, X as devices, aa as waitForAnyElement, ab as waitForElement, ac as waitForNavigation, ad as waitForNetworkIdle } from './types-
|
|
2
|
+
import { R as RequestPattern, a as RequestHandler, C as CaptureResult } from './types-DtGF3yGl.js';
|
|
3
|
+
export { k as ActionOptions, l as ActionResult, A as ActionType, d as AudioChunk, e as AudioInput, f as AudioInputState, g as AudioOutput, B as BatchOptions, b as BatchResult, h as CaptureOptions, a3 as ClearCookiesOptions, m as ConsoleHandler, n as ConsoleMessage, o as ConsoleMessageType, Y as ContinueRequestOptions, a4 as Cookie, p as CustomSelectConfig, a5 as DeleteCookieOptions, O as DeviceDescriptor, Q as DeviceName, D as Dialog, q as DialogHandler, r as DialogType, s as Download, E as ElementInfo, t as ElementNotFoundError, u as EmulationState, v as ErrorHandler, Z as FailRequestOptions, F as FileInput, w as FillOptions, _ as FulfillRequestOptions, G as GeolocationOptions, I as InteractiveElement, $ as InterceptedRequest, N as NavigationError, x as NetworkIdleOptions, y as Page, z as PageError, H as PageSnapshot, P as PlayOptions, a0 as RequestActions, a1 as ResourceType, i as RoundTripOptions, j as RoundTripResult, a2 as RouteOptions, a6 as SetCookieOptions, J as SnapshotNode, S as Step, c as StepResult, K as SubmitOptions, T as TimeoutError, L as TypeOptions, U as UserAgentMetadata, M as UserAgentOptions, V as ViewportOptions, W as WaitForOptions, a7 as WaitOptions, a8 as WaitResult, a9 as WaitState, X as devices, aa as waitForAnyElement, ab as waitForElement, ac as waitForNavigation, ad as waitForNetworkIdle } from './types-DtGF3yGl.js';
|
|
4
4
|
import { C as CDPClient } from './client-7Nqka5MV.js';
|
|
5
5
|
export { a as CDPClientOptions, c as createCDPClient } from './client-7Nqka5MV.js';
|
|
6
|
-
export { Browser, BrowserOptions, connect } from './browser.js';
|
|
6
|
+
export { Browser, BrowserOptions, PageOptions, connect } from './browser.js';
|
|
7
7
|
export { CDPError } from './cdp.js';
|
|
8
8
|
export { BrowserBaseProvider, BrowserlessProvider, GenericProvider, createProvider, discoverTargets, getBrowserWebSocketUrl } from './providers.js';
|
|
9
9
|
export { b as ConnectOptions, C as CreateSessionOptions, P as Provider, a as ProviderSession } from './types--wXNHUwt.js';
|
package/dist/index.mjs
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
waitForElement,
|
|
17
17
|
waitForNavigation,
|
|
18
18
|
waitForNetworkIdle
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-JHAF52FA.mjs";
|
|
20
20
|
import {
|
|
21
21
|
CDPError,
|
|
22
22
|
createCDPClient
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
createProvider,
|
|
29
29
|
discoverTargets,
|
|
30
30
|
getBrowserWebSocketUrl
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-BRAFQUMG.mjs";
|
|
32
32
|
import {
|
|
33
33
|
BatchExecutor,
|
|
34
34
|
ElementNotFoundError,
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
TimeoutError,
|
|
37
37
|
addBatchToPage,
|
|
38
38
|
validateSteps
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-FAUNIZR7.mjs";
|
|
40
40
|
|
|
41
41
|
// src/audio/flags.ts
|
|
42
42
|
function getAudioChromeFlags(options) {
|
package/dist/providers.cjs
CHANGED
|
@@ -160,6 +160,34 @@ var BrowserlessProvider = class {
|
|
|
160
160
|
};
|
|
161
161
|
|
|
162
162
|
// src/providers/generic.ts
|
|
163
|
+
function sleep(ms) {
|
|
164
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
165
|
+
}
|
|
166
|
+
async function fetchDevToolsJson(host, path, errorPrefix, options = {}) {
|
|
167
|
+
const protocol = host.includes("://") ? "" : "http://";
|
|
168
|
+
const attempts = options.attempts ?? 1;
|
|
169
|
+
let delayMs = options.initialDelayMs ?? 50;
|
|
170
|
+
const maxDelayMs = options.maxDelayMs ?? 250;
|
|
171
|
+
let lastError;
|
|
172
|
+
for (let attempt = 1; attempt <= attempts; attempt++) {
|
|
173
|
+
try {
|
|
174
|
+
const response = await fetch(`${protocol}${host}${path}`);
|
|
175
|
+
if (response.ok) {
|
|
176
|
+
return await response.json();
|
|
177
|
+
}
|
|
178
|
+
lastError = new Error(`${errorPrefix}: ${response.status}`);
|
|
179
|
+
} catch (error) {
|
|
180
|
+
lastError = new Error(
|
|
181
|
+
`${errorPrefix}: ${error instanceof Error ? error.message : String(error)}`
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
if (attempt < attempts) {
|
|
185
|
+
await sleep(delayMs);
|
|
186
|
+
delayMs = Math.min(delayMs * 2, maxDelayMs);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
throw lastError ?? new Error(errorPrefix);
|
|
190
|
+
}
|
|
163
191
|
var GenericProvider = class {
|
|
164
192
|
name = "generic";
|
|
165
193
|
wsUrl;
|
|
@@ -178,20 +206,14 @@ var GenericProvider = class {
|
|
|
178
206
|
}
|
|
179
207
|
};
|
|
180
208
|
async function discoverTargets(host = "localhost:9222") {
|
|
181
|
-
|
|
182
|
-
const response = await fetch(`${protocol}${host}/json/list`);
|
|
183
|
-
if (!response.ok) {
|
|
184
|
-
throw new Error(`Failed to discover targets: ${response.status}`);
|
|
185
|
-
}
|
|
186
|
-
return await response.json();
|
|
209
|
+
return fetchDevToolsJson(host, "/json/list", "Failed to discover targets");
|
|
187
210
|
}
|
|
188
211
|
async function getBrowserWebSocketUrl(host = "localhost:9222") {
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
194
|
-
const info = await response.json();
|
|
212
|
+
const info = await fetchDevToolsJson(host, "/json/version", "Failed to get browser info", {
|
|
213
|
+
attempts: 10,
|
|
214
|
+
initialDelayMs: 50,
|
|
215
|
+
maxDelayMs: 250
|
|
216
|
+
});
|
|
195
217
|
return info.webSocketDebuggerUrl;
|
|
196
218
|
}
|
|
197
219
|
|
package/dist/providers.mjs
CHANGED
|
@@ -270,10 +270,10 @@ interface ActionOptions {
|
|
|
270
270
|
optional?: boolean;
|
|
271
271
|
}
|
|
272
272
|
interface FillOptions extends ActionOptions {
|
|
273
|
-
/** Clear existing content before filling */
|
|
274
|
-
clear?: boolean;
|
|
275
273
|
/** Trigger blur after filling (useful for React/Vue frameworks that update on blur) */
|
|
276
274
|
blur?: boolean;
|
|
275
|
+
/** Verify value stuck after fill; falls back to char-by-char typing if not (default: true) */
|
|
276
|
+
verify?: boolean;
|
|
277
277
|
}
|
|
278
278
|
interface TypeOptions extends ActionOptions {
|
|
279
279
|
/** Delay between keystrokes in ms */
|
|
@@ -707,6 +707,8 @@ declare class Page {
|
|
|
707
707
|
private currentFrameContextId;
|
|
708
708
|
/** Last matched selector from findElement (for selectorUsed tracking) */
|
|
709
709
|
private _lastMatchedSelector;
|
|
710
|
+
/** Last snapshot for stale ref recovery */
|
|
711
|
+
private lastSnapshot?;
|
|
710
712
|
/** Audio input controller (lazy-initialized) */
|
|
711
713
|
private _audioInput?;
|
|
712
714
|
/** Audio output controller (lazy-initialized) */
|
|
@@ -730,6 +732,7 @@ declare class Page {
|
|
|
730
732
|
* Initialize the page (enable required CDP domains)
|
|
731
733
|
*/
|
|
732
734
|
init(): Promise<void>;
|
|
735
|
+
private installEventListenerTracker;
|
|
733
736
|
/**
|
|
734
737
|
* Navigate to a URL
|
|
735
738
|
*/
|
|
@@ -757,8 +760,9 @@ declare class Page {
|
|
|
757
760
|
/**
|
|
758
761
|
* Click an element (supports multi-selector)
|
|
759
762
|
*
|
|
760
|
-
* Uses CDP mouse events
|
|
761
|
-
*
|
|
763
|
+
* Uses CDP mouse events (mouseMoved + mousePressed + mouseReleased) to
|
|
764
|
+
* simulate a real click. Real mouse events on submit buttons naturally
|
|
765
|
+
* trigger native form submission — no JS dispatch needed.
|
|
762
766
|
*/
|
|
763
767
|
click(selector: string | string[], options?: ActionOptions): Promise<boolean>;
|
|
764
768
|
/**
|
|
@@ -767,6 +771,10 @@ declare class Page {
|
|
|
767
771
|
fill(selector: string | string[], value: string, options?: FillOptions): Promise<boolean>;
|
|
768
772
|
/**
|
|
769
773
|
* Type text character by character (for autocomplete fields, etc.)
|
|
774
|
+
*
|
|
775
|
+
* Uses proper keyDown/rawKeyDown distinction with US keyboard layout.
|
|
776
|
+
* Printable chars use 'keyDown' with text, non-text keys use 'rawKeyDown',
|
|
777
|
+
* and non-layout chars (emoji, CJK) fall back to Input.insertText.
|
|
770
778
|
*/
|
|
771
779
|
type(selector: string | string[], text: string, options?: TypeOptions): Promise<boolean>;
|
|
772
780
|
/**
|
|
@@ -779,11 +787,13 @@ declare class Page {
|
|
|
779
787
|
*/
|
|
780
788
|
private selectCustom;
|
|
781
789
|
/**
|
|
782
|
-
* Check a checkbox or radio button
|
|
790
|
+
* Check a checkbox or radio button using real mouse click.
|
|
791
|
+
* No-op if already checked. Verifies state changed after click.
|
|
783
792
|
*/
|
|
784
793
|
check(selector: string | string[], options?: ActionOptions): Promise<boolean>;
|
|
785
794
|
/**
|
|
786
|
-
* Uncheck a checkbox
|
|
795
|
+
* Uncheck a checkbox using real mouse click.
|
|
796
|
+
* No-op if already unchecked. Radio buttons can't be unchecked (returns true).
|
|
787
797
|
*/
|
|
788
798
|
uncheck(selector: string | string[], options?: ActionOptions): Promise<boolean>;
|
|
789
799
|
/**
|
|
@@ -864,6 +874,17 @@ declare class Page {
|
|
|
864
874
|
* Set files on a file input
|
|
865
875
|
*/
|
|
866
876
|
setInputFiles(selector: string | string[], files: FileInput[], options?: ActionOptions): Promise<boolean>;
|
|
877
|
+
private getNativeSelectMetadata;
|
|
878
|
+
private readNativeSelectValues;
|
|
879
|
+
private selectValuesMatch;
|
|
880
|
+
private applyNativeSelectByKeyboard;
|
|
881
|
+
private applyNativeSelectFallback;
|
|
882
|
+
private selectEditableContent;
|
|
883
|
+
private clearEditableSelection;
|
|
884
|
+
private readEditableValue;
|
|
885
|
+
private typeEditableFallback;
|
|
886
|
+
private applyRecordedSelectFallback;
|
|
887
|
+
private invokeRecordedEventListeners;
|
|
867
888
|
/**
|
|
868
889
|
* Wait for a download to complete, triggered by an action
|
|
869
890
|
*/
|
|
@@ -1082,9 +1103,18 @@ declare class Page {
|
|
|
1082
1103
|
*/
|
|
1083
1104
|
private getBoxModel;
|
|
1084
1105
|
/**
|
|
1085
|
-
* Click an element by node ID
|
|
1106
|
+
* Click an element by node ID using Playwright's 3-event sequence:
|
|
1107
|
+
* mouseMoved → mousePressed → mouseReleased (sequential).
|
|
1108
|
+
* Uses DOM.getContentQuads for accurate coordinates (handles CSS transforms).
|
|
1109
|
+
* Falls back to JS this.click() if CDP mouse dispatch fails.
|
|
1086
1110
|
*/
|
|
1087
1111
|
private clickElement;
|
|
1112
|
+
/**
|
|
1113
|
+
* Resolve a nodeId to a Remote Object ID for use with Runtime.callFunctionOn
|
|
1114
|
+
*/
|
|
1115
|
+
private resolveObjectId;
|
|
1116
|
+
private dispatchKeyDefinition;
|
|
1117
|
+
private dispatchKey;
|
|
1088
1118
|
/**
|
|
1089
1119
|
* Audio input controller (fake microphone).
|
|
1090
1120
|
* Lazy-initialized on first access.
|
|
@@ -1146,14 +1176,12 @@ interface Step {
|
|
|
1146
1176
|
optional?: boolean;
|
|
1147
1177
|
/** Submit method */
|
|
1148
1178
|
method?: 'enter' | 'click' | 'enter+click';
|
|
1149
|
-
/** Clear input before filling */
|
|
1150
|
-
clear?: boolean;
|
|
1151
1179
|
/** Trigger blur after filling (for React/Vue frameworks) */
|
|
1152
1180
|
blur?: boolean;
|
|
1153
1181
|
/** Delay between keystrokes for type action */
|
|
1154
1182
|
delay?: number;
|
|
1155
|
-
/** Wait
|
|
1156
|
-
waitForNavigation?: boolean;
|
|
1183
|
+
/** Wait mode after click/submit: true, false, or 'auto' for submit heuristics */
|
|
1184
|
+
waitForNavigation?: boolean | 'auto';
|
|
1157
1185
|
/** Custom select: trigger selector */
|
|
1158
1186
|
trigger?: string | string[];
|
|
1159
1187
|
/** Custom select: option selector */
|
|
@@ -270,10 +270,10 @@ interface ActionOptions {
|
|
|
270
270
|
optional?: boolean;
|
|
271
271
|
}
|
|
272
272
|
interface FillOptions extends ActionOptions {
|
|
273
|
-
/** Clear existing content before filling */
|
|
274
|
-
clear?: boolean;
|
|
275
273
|
/** Trigger blur after filling (useful for React/Vue frameworks that update on blur) */
|
|
276
274
|
blur?: boolean;
|
|
275
|
+
/** Verify value stuck after fill; falls back to char-by-char typing if not (default: true) */
|
|
276
|
+
verify?: boolean;
|
|
277
277
|
}
|
|
278
278
|
interface TypeOptions extends ActionOptions {
|
|
279
279
|
/** Delay between keystrokes in ms */
|
|
@@ -707,6 +707,8 @@ declare class Page {
|
|
|
707
707
|
private currentFrameContextId;
|
|
708
708
|
/** Last matched selector from findElement (for selectorUsed tracking) */
|
|
709
709
|
private _lastMatchedSelector;
|
|
710
|
+
/** Last snapshot for stale ref recovery */
|
|
711
|
+
private lastSnapshot?;
|
|
710
712
|
/** Audio input controller (lazy-initialized) */
|
|
711
713
|
private _audioInput?;
|
|
712
714
|
/** Audio output controller (lazy-initialized) */
|
|
@@ -730,6 +732,7 @@ declare class Page {
|
|
|
730
732
|
* Initialize the page (enable required CDP domains)
|
|
731
733
|
*/
|
|
732
734
|
init(): Promise<void>;
|
|
735
|
+
private installEventListenerTracker;
|
|
733
736
|
/**
|
|
734
737
|
* Navigate to a URL
|
|
735
738
|
*/
|
|
@@ -757,8 +760,9 @@ declare class Page {
|
|
|
757
760
|
/**
|
|
758
761
|
* Click an element (supports multi-selector)
|
|
759
762
|
*
|
|
760
|
-
* Uses CDP mouse events
|
|
761
|
-
*
|
|
763
|
+
* Uses CDP mouse events (mouseMoved + mousePressed + mouseReleased) to
|
|
764
|
+
* simulate a real click. Real mouse events on submit buttons naturally
|
|
765
|
+
* trigger native form submission — no JS dispatch needed.
|
|
762
766
|
*/
|
|
763
767
|
click(selector: string | string[], options?: ActionOptions): Promise<boolean>;
|
|
764
768
|
/**
|
|
@@ -767,6 +771,10 @@ declare class Page {
|
|
|
767
771
|
fill(selector: string | string[], value: string, options?: FillOptions): Promise<boolean>;
|
|
768
772
|
/**
|
|
769
773
|
* Type text character by character (for autocomplete fields, etc.)
|
|
774
|
+
*
|
|
775
|
+
* Uses proper keyDown/rawKeyDown distinction with US keyboard layout.
|
|
776
|
+
* Printable chars use 'keyDown' with text, non-text keys use 'rawKeyDown',
|
|
777
|
+
* and non-layout chars (emoji, CJK) fall back to Input.insertText.
|
|
770
778
|
*/
|
|
771
779
|
type(selector: string | string[], text: string, options?: TypeOptions): Promise<boolean>;
|
|
772
780
|
/**
|
|
@@ -779,11 +787,13 @@ declare class Page {
|
|
|
779
787
|
*/
|
|
780
788
|
private selectCustom;
|
|
781
789
|
/**
|
|
782
|
-
* Check a checkbox or radio button
|
|
790
|
+
* Check a checkbox or radio button using real mouse click.
|
|
791
|
+
* No-op if already checked. Verifies state changed after click.
|
|
783
792
|
*/
|
|
784
793
|
check(selector: string | string[], options?: ActionOptions): Promise<boolean>;
|
|
785
794
|
/**
|
|
786
|
-
* Uncheck a checkbox
|
|
795
|
+
* Uncheck a checkbox using real mouse click.
|
|
796
|
+
* No-op if already unchecked. Radio buttons can't be unchecked (returns true).
|
|
787
797
|
*/
|
|
788
798
|
uncheck(selector: string | string[], options?: ActionOptions): Promise<boolean>;
|
|
789
799
|
/**
|
|
@@ -864,6 +874,17 @@ declare class Page {
|
|
|
864
874
|
* Set files on a file input
|
|
865
875
|
*/
|
|
866
876
|
setInputFiles(selector: string | string[], files: FileInput[], options?: ActionOptions): Promise<boolean>;
|
|
877
|
+
private getNativeSelectMetadata;
|
|
878
|
+
private readNativeSelectValues;
|
|
879
|
+
private selectValuesMatch;
|
|
880
|
+
private applyNativeSelectByKeyboard;
|
|
881
|
+
private applyNativeSelectFallback;
|
|
882
|
+
private selectEditableContent;
|
|
883
|
+
private clearEditableSelection;
|
|
884
|
+
private readEditableValue;
|
|
885
|
+
private typeEditableFallback;
|
|
886
|
+
private applyRecordedSelectFallback;
|
|
887
|
+
private invokeRecordedEventListeners;
|
|
867
888
|
/**
|
|
868
889
|
* Wait for a download to complete, triggered by an action
|
|
869
890
|
*/
|
|
@@ -1082,9 +1103,18 @@ declare class Page {
|
|
|
1082
1103
|
*/
|
|
1083
1104
|
private getBoxModel;
|
|
1084
1105
|
/**
|
|
1085
|
-
* Click an element by node ID
|
|
1106
|
+
* Click an element by node ID using Playwright's 3-event sequence:
|
|
1107
|
+
* mouseMoved → mousePressed → mouseReleased (sequential).
|
|
1108
|
+
* Uses DOM.getContentQuads for accurate coordinates (handles CSS transforms).
|
|
1109
|
+
* Falls back to JS this.click() if CDP mouse dispatch fails.
|
|
1086
1110
|
*/
|
|
1087
1111
|
private clickElement;
|
|
1112
|
+
/**
|
|
1113
|
+
* Resolve a nodeId to a Remote Object ID for use with Runtime.callFunctionOn
|
|
1114
|
+
*/
|
|
1115
|
+
private resolveObjectId;
|
|
1116
|
+
private dispatchKeyDefinition;
|
|
1117
|
+
private dispatchKey;
|
|
1088
1118
|
/**
|
|
1089
1119
|
* Audio input controller (fake microphone).
|
|
1090
1120
|
* Lazy-initialized on first access.
|
|
@@ -1146,14 +1176,12 @@ interface Step {
|
|
|
1146
1176
|
optional?: boolean;
|
|
1147
1177
|
/** Submit method */
|
|
1148
1178
|
method?: 'enter' | 'click' | 'enter+click';
|
|
1149
|
-
/** Clear input before filling */
|
|
1150
|
-
clear?: boolean;
|
|
1151
1179
|
/** Trigger blur after filling (for React/Vue frameworks) */
|
|
1152
1180
|
blur?: boolean;
|
|
1153
1181
|
/** Delay between keystrokes for type action */
|
|
1154
1182
|
delay?: number;
|
|
1155
|
-
/** Wait
|
|
1156
|
-
waitForNavigation?: boolean;
|
|
1183
|
+
/** Wait mode after click/submit: true, false, or 'auto' for submit heuristics */
|
|
1184
|
+
waitForNavigation?: boolean | 'auto';
|
|
1157
1185
|
/** Custom select: trigger selector */
|
|
1158
1186
|
trigger?: string | string[];
|
|
1159
1187
|
/** Custom select: option selector */
|