browser-debugger-cli 0.8.0 → 0.9.0
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 +4 -1
- package/dist/cdp/schema.d.ts +4 -1
- package/dist/cdp/schema.js +48 -7
- package/dist/commands/cdp.js +3 -2
- package/dist/commands/cleanup.d.ts +11 -0
- package/dist/commands/cleanup.js +161 -57
- package/dist/commands/console.d.ts +20 -1
- package/dist/commands/console.js +57 -17
- package/dist/commands/details.js +3 -2
- package/dist/commands/dom/DomElementResolver.d.ts +10 -3
- package/dist/commands/dom/DomElementResolver.js +35 -17
- package/dist/commands/dom/a11y.d.ts +10 -0
- package/dist/commands/dom/a11y.js +27 -5
- package/dist/commands/dom/eval.d.ts +3 -1
- package/dist/commands/dom/eval.js +29 -4
- package/dist/commands/dom/form.js +16 -62
- package/dist/commands/dom/formInteraction.js +152 -113
- package/dist/commands/dom/formSummary.d.ts +49 -0
- package/dist/commands/dom/formSummary.js +180 -0
- package/dist/commands/dom/frames.d.ts +2 -1
- package/dist/commands/dom/frames.js +17 -2
- package/dist/commands/dom/get.d.ts +6 -5
- package/dist/commands/dom/get.js +92 -82
- package/dist/commands/dom/helpers/index.d.ts +1 -1
- package/dist/commands/dom/helpers/index.js +1 -1
- package/dist/commands/dom/helpers/query.d.ts +44 -17
- package/dist/commands/dom/helpers/query.js +244 -97
- package/dist/commands/dom/helpers/runElementCommand.d.ts +10 -2
- package/dist/commands/dom/helpers/runElementCommand.js +97 -30
- package/dist/commands/dom/helpers/screenshot.d.ts +4 -1
- package/dist/commands/dom/helpers/screenshot.js +164 -49
- package/dist/commands/dom/index.d.ts +3 -1
- package/dist/commands/dom/index.js +16 -6
- package/dist/commands/dom/layout.d.ts +14 -0
- package/dist/commands/dom/layout.js +54 -0
- package/dist/commands/dom/listeners.d.ts +5 -1
- package/dist/commands/dom/listeners.js +13 -3
- package/dist/commands/dom/query.js +2 -3
- package/dist/commands/dom/screenshot.d.ts +12 -2
- package/dist/commands/dom/screenshot.js +27 -3
- package/dist/commands/dom/semanticUtils.d.ts +6 -13
- package/dist/commands/dom/semanticUtils.js +15 -19
- package/dist/commands/dom/wait.d.ts +13 -0
- package/dist/commands/dom/wait.js +83 -0
- package/dist/commands/helpJson.js +2 -2
- package/dist/commands/network/list.js +4 -11
- package/dist/commands/optionBehaviors.js +112 -21
- package/dist/commands/page.d.ts +2 -1
- package/dist/commands/page.js +41 -5
- package/dist/commands/peek.js +4 -11
- package/dist/commands/sessions.d.ts +8 -0
- package/dist/commands/sessions.js +19 -0
- package/dist/commands/shared/CommandRunner.js +4 -4
- package/dist/commands/shared/dataFetcher.js +2 -2
- package/dist/commands/shared/followMode.d.ts +21 -1
- package/dist/commands/shared/followMode.js +29 -2
- package/dist/commands/shared/handleValidationError.d.ts +2 -2
- package/dist/commands/shared/handleValidationError.js +12 -3
- package/dist/commands/shared/optionTypes.d.ts +40 -5
- package/dist/commands/shared/startHelpers.js +12 -3
- package/dist/commands/shared/validation.d.ts +3 -2
- package/dist/commands/shared/validation.js +4 -3
- package/dist/commands/start.d.ts +63 -0
- package/dist/commands/start.js +115 -15
- package/dist/commands/status.js +29 -7
- package/dist/commands/stop.js +7 -6
- package/dist/commands/tail.js +4 -11
- package/dist/commands/types.d.ts +2 -0
- package/dist/commands.js +2 -0
- package/dist/connection/chromeIdentity.d.ts +65 -0
- package/dist/connection/chromeIdentity.js +143 -0
- package/dist/connection/launcher/profilePreferences.d.ts +47 -0
- package/dist/connection/launcher/profilePreferences.js +151 -0
- package/dist/connection/launcher.d.ts +21 -2
- package/dist/connection/launcher.js +42 -16
- package/dist/connection/portReservation.d.ts +14 -4
- package/dist/connection/portReservation.js +21 -6
- package/dist/connection/startupExit.d.ts +8 -0
- package/dist/connection/startupExit.js +15 -6
- package/dist/constants.d.ts +6 -2
- package/dist/constants.js +9 -2
- package/dist/daemon/SessionController.js +23 -7
- package/dist/daemon/errors.d.ts +1 -1
- package/dist/daemon/errors.js +1 -1
- package/dist/daemon/launcher.d.ts +2 -1
- package/dist/daemon/launcher.js +5 -6
- package/dist/daemon/server/SocketServer.js +1 -2
- package/dist/daemon/session/Session.d.ts +13 -0
- package/dist/daemon/session/Session.js +57 -8
- package/dist/daemon/session/chromeConnection.d.ts +9 -0
- package/dist/daemon/session/chromeConnection.js +45 -8
- package/dist/daemon/session/commandRegistry.js +52 -62
- package/dist/daemon/session/interactions.d.ts +35 -9
- package/dist/daemon/session/interactions.js +36 -9
- package/dist/daemon/session/triggeredRequests.d.ts +67 -0
- package/dist/daemon/session/triggeredRequests.js +157 -0
- package/dist/daemon/session/types.d.ts +5 -1
- package/dist/daemon.js +5393 -1600
- package/dist/errors/messages.d.ts +387 -24
- package/dist/errors/messages.js +761 -67
- package/dist/index.js +3976 -1558
- package/dist/ipc/client.d.ts +12 -1
- package/dist/ipc/client.js +22 -3
- package/dist/ipc/protocol/commands.d.ts +89 -4
- package/dist/ipc/protocol/commands.js +2 -0
- package/dist/ipc/protocol/domTypes.d.ts +258 -7
- package/dist/ipc/session/lifecycle.d.ts +8 -1
- package/dist/ipc/session/queries.d.ts +5 -1
- package/dist/ipc/session/types.d.ts +5 -0
- package/dist/ipc/transport/index.d.ts +2 -1
- package/dist/ipc/transport/index.js +2 -2
- package/dist/runtime/dom/actionEffects.d.ts +106 -0
- package/dist/runtime/dom/actionEffects.js +256 -0
- package/dist/runtime/dom/actionEffectsScripts.d.ts +52 -0
- package/dist/runtime/dom/actionEffectsScripts.js +234 -0
- package/dist/runtime/dom/elementGeometry.d.ts +170 -0
- package/dist/runtime/dom/elementGeometry.js +553 -0
- package/dist/runtime/dom/elementInfo.d.ts +77 -0
- package/dist/runtime/dom/elementInfo.js +191 -0
- package/dist/runtime/dom/evalHelpers.d.ts +51 -6
- package/dist/runtime/dom/evalHelpers.js +136 -26
- package/dist/runtime/dom/eventListeners.d.ts +2 -1
- package/dist/runtime/dom/eventListeners.js +174 -47
- package/dist/runtime/dom/formDiscovery.d.ts +1 -1
- package/dist/runtime/dom/formDiscovery.js +116 -16
- package/dist/runtime/dom/formFillHelpers/fill.d.ts +10 -0
- package/dist/runtime/dom/formFillHelpers/fill.js +125 -10
- package/dist/runtime/dom/formFillHelpers/index.d.ts +2 -2
- package/dist/runtime/dom/formFillHelpers/index.js +2 -2
- package/dist/runtime/dom/formFillHelpers/pressKey.js +14 -3
- package/dist/runtime/dom/formFillHelpers/scroll.d.ts +3 -0
- package/dist/runtime/dom/formFillHelpers/scroll.js +60 -18
- package/dist/runtime/dom/formFillHelpers/shared.d.ts +17 -0
- package/dist/runtime/dom/formFillHelpers/shared.js +25 -1
- package/dist/runtime/dom/formFillHelpers/stability.d.ts +20 -6
- package/dist/runtime/dom/formFillHelpers/stability.js +50 -19
- package/dist/runtime/dom/formSubmitHelpers.d.ts +3 -0
- package/dist/runtime/dom/formSubmitHelpers.js +89 -15
- package/dist/runtime/dom/frameLayout.d.ts +60 -0
- package/dist/runtime/dom/frameLayout.js +140 -0
- package/dist/runtime/dom/frameOrigin.d.ts +50 -0
- package/dist/runtime/dom/frameOrigin.js +62 -0
- package/dist/runtime/dom/frameScopedConnection.d.ts +92 -0
- package/dist/runtime/dom/frameScopedConnection.js +252 -0
- package/dist/runtime/dom/frameSelection.d.ts +1 -1
- package/dist/runtime/dom/frameSelection.js +2 -2
- package/dist/runtime/dom/frames.d.ts +25 -2
- package/dist/runtime/dom/frames.js +202 -63
- package/dist/runtime/dom/layout.d.ts +67 -0
- package/dist/runtime/dom/layout.js +333 -0
- package/dist/runtime/dom/listenerPageScripts.d.ts +66 -0
- package/dist/runtime/dom/listenerPageScripts.js +279 -0
- package/dist/runtime/dom/listenerSummary.d.ts +132 -11
- package/dist/runtime/dom/listenerSummary.js +344 -22
- package/dist/runtime/dom/pageActivity.d.ts +41 -0
- package/dist/runtime/dom/pageActivity.js +123 -0
- package/dist/runtime/dom/reactEventHelpers.d.ts +58 -2
- package/dist/runtime/dom/reactEventHelpers.js +212 -41
- package/dist/runtime/dom/targetNode.d.ts +80 -27
- package/dist/runtime/dom/targetNode.js +249 -33
- package/dist/runtime/dom/wait.d.ts +25 -0
- package/dist/runtime/dom/wait.js +199 -0
- package/dist/runtime/dom/waitCondition.d.ts +71 -0
- package/dist/runtime/dom/waitCondition.js +75 -0
- package/dist/runtime/page/emulation.d.ts +51 -0
- package/dist/runtime/page/emulation.js +80 -0
- package/dist/runtime/page/loadingState.d.ts +36 -0
- package/dist/runtime/page/loadingState.js +86 -0
- package/dist/runtime/page/navigation.d.ts +46 -2
- package/dist/runtime/page/navigation.js +69 -33
- package/dist/session/QueryCacheManager.d.ts +11 -1
- package/dist/session/QueryCacheManager.js +25 -3
- package/dist/session/chromeOwners.d.ts +34 -0
- package/dist/session/chromeOwners.js +51 -0
- package/dist/session/cleanup/staleSession.d.ts +11 -1
- package/dist/session/cleanup/staleSession.js +17 -6
- package/dist/session/cleanup/userCommands.js +2 -4
- package/dist/session/metadata.d.ts +5 -1
- package/dist/session/metadata.js +2 -1
- package/dist/session/paths.d.ts +77 -3
- package/dist/session/paths.js +111 -5
- package/dist/session/port.d.ts +31 -7
- package/dist/session/port.js +50 -43
- package/dist/session/portClaims.d.ts +66 -0
- package/dist/session/portClaims.js +284 -0
- package/dist/session/sessionList.d.ts +58 -0
- package/dist/session/sessionList.js +199 -0
- package/dist/session/sessionName.d.ts +46 -0
- package/dist/session/sessionName.js +97 -0
- package/dist/telemetry/a11y.d.ts +8 -3
- package/dist/telemetry/a11y.js +92 -28
- package/dist/telemetry/requestKinds.d.ts +32 -0
- package/dist/telemetry/requestKinds.js +61 -0
- package/dist/telemetry/requestState.d.ts +31 -0
- package/dist/telemetry/requestState.js +38 -0
- package/dist/types.d.ts +80 -3
- package/dist/ui/formatters/a11y.js +3 -0
- package/dist/ui/formatters/console/chronological.d.ts +8 -0
- package/dist/ui/formatters/console/chronological.js +17 -4
- package/dist/ui/formatters/console/json.js +3 -4
- package/dist/ui/formatters/console/shared.d.ts +12 -0
- package/dist/ui/formatters/console.d.ts +2 -2
- package/dist/ui/formatters/console.js +1 -1
- package/dist/ui/formatters/details.js +2 -1
- package/dist/ui/formatters/dom.d.ts +26 -14
- package/dist/ui/formatters/dom.js +65 -52
- package/dist/ui/formatters/form.js +29 -18
- package/dist/ui/formatters/layout.d.ts +31 -0
- package/dist/ui/formatters/layout.js +53 -0
- package/dist/ui/formatters/listeners.d.ts +3 -2
- package/dist/ui/formatters/listeners.js +73 -9
- package/dist/ui/formatters/networkHeaders.js +13 -0
- package/dist/ui/formatters/preview.js +2 -1
- package/dist/ui/formatters/requestStatus.d.ts +1 -17
- package/dist/ui/formatters/requestStatus.js +2 -30
- package/dist/ui/formatters/sessions.d.ts +12 -0
- package/dist/ui/formatters/sessions.js +40 -0
- package/dist/ui/formatters/status.d.ts +21 -2
- package/dist/ui/formatters/status.js +47 -10
- package/dist/ui/formatters/triggeredRequests.d.ts +36 -0
- package/dist/ui/formatters/triggeredRequests.js +65 -0
- package/dist/ui/formatting.d.ts +10 -0
- package/dist/ui/formatting.js +28 -36
- package/dist/ui/messages/chrome.d.ts +9 -0
- package/dist/ui/messages/chrome.js +17 -5
- package/dist/ui/messages/commands.d.ts +388 -14
- package/dist/ui/messages/commands.js +664 -21
- package/dist/ui/messages/consoleMessages.d.ts +10 -0
- package/dist/ui/messages/consoleMessages.js +17 -0
- package/dist/ui/messages/hints.js +2 -1
- package/dist/ui/messages/preview.js +5 -4
- package/dist/ui/messages/session.d.ts +16 -21
- package/dist/ui/messages/session.js +28 -26
- package/dist/ui/messages/sessionCommand.d.ts +43 -0
- package/dist/ui/messages/sessionCommand.js +52 -0
- package/dist/utils/async.d.ts +8 -0
- package/dist/utils/async.js +19 -0
- package/dist/utils/http.d.ts +22 -1
- package/dist/utils/http.js +28 -9
- package/dist/utils/selectorFilters.d.ts +36 -8
- package/dist/utils/selectorFilters.js +267 -53
- package/dist/utils/shellDetection.d.ts +8 -2
- package/dist/utils/shellDetection.js +120 -33
- package/dist/utils/suggestions.d.ts +26 -0
- package/dist/utils/suggestions.js +73 -0
- package/dist/utils/taskMappings.js +10 -0
- package/dist/utils/url.d.ts +12 -2
- package/dist/utils/url.js +69 -7
- package/package.json +1 -1
- package/dist/ui/formatters/sessionFormatters.d.ts +0 -58
- package/dist/ui/formatters/sessionFormatters.js +0 -121
package/dist/ipc/client.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export declare function connectToDaemon(): Promise<HandshakeResponse>;
|
|
|
28
28
|
* Request status information from the daemon.
|
|
29
29
|
* Returns daemon state, session metadata, and activity metrics.
|
|
30
30
|
*
|
|
31
|
+
* @param socketPath - Daemon socket to ask (default: the selected session's)
|
|
31
32
|
* @returns Status response with daemon and session information
|
|
32
33
|
* @throws Error if connection fails or times out
|
|
33
34
|
*
|
|
@@ -40,7 +41,7 @@ export declare function connectToDaemon(): Promise<HandshakeResponse>;
|
|
|
40
41
|
* }
|
|
41
42
|
* ```
|
|
42
43
|
*/
|
|
43
|
-
export declare function getStatus(): Promise<StatusResponse>;
|
|
44
|
+
export declare function getStatus(socketPath?: string): Promise<StatusResponse>;
|
|
44
45
|
/**
|
|
45
46
|
* Request preview data from the daemon.
|
|
46
47
|
* Returns snapshot of collected telemetry without stopping session.
|
|
@@ -221,4 +222,14 @@ export declare function pageNavigate(params: NoType<(typeof COMMANDS)['page_navi
|
|
|
221
222
|
export declare function domFormDiscover(): Promise<ClientResponse<'dom_form_discover'>>;
|
|
222
223
|
/** List the event listeners that run for an element. */
|
|
223
224
|
export declare function domListeners(params: NoType<(typeof COMMANDS)['dom_listeners']['requestSchema']>): Promise<ClientResponse<'dom_listeners'>>;
|
|
225
|
+
/** Positions, sizes and visibility of elements. */
|
|
226
|
+
export declare function domLayout(params: NoType<(typeof COMMANDS)['dom_layout']['requestSchema']>): Promise<ClientResponse<'dom_layout'>>;
|
|
227
|
+
/**
|
|
228
|
+
* Wait until elements appear, become visible, contain a text or are gone,
|
|
229
|
+
* and/or the page has loaded.
|
|
230
|
+
*
|
|
231
|
+
* @param params - Condition and timeout
|
|
232
|
+
* @returns What the page showed once the condition was met
|
|
233
|
+
*/
|
|
234
|
+
export declare function domWait(params: NoType<(typeof COMMANDS)['dom_wait']['requestSchema']>): Promise<ClientResponse<'dom_wait'>>;
|
|
224
235
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/ipc/client.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Public API for communicating with the daemon via Unix socket.
|
|
5
5
|
* Provides high-level functions for session lifecycle and queries.
|
|
6
6
|
*/
|
|
7
|
-
import { getQuickIPCRequestTimeout } from '../constants.js';
|
|
7
|
+
import { getIPCRequestTimeout, getQuickIPCRequestTimeout } from '../constants.js';
|
|
8
8
|
import { CommandError } from '../errors/index.js';
|
|
9
9
|
import { EXIT_CODES } from '../utils/exitCodes.js';
|
|
10
10
|
import { sendRequest } from './transport/index.js';
|
|
@@ -42,6 +42,7 @@ async function assertResponsive() {
|
|
|
42
42
|
* Request status information from the daemon.
|
|
43
43
|
* Returns daemon state, session metadata, and activity metrics.
|
|
44
44
|
*
|
|
45
|
+
* @param socketPath - Daemon socket to ask (default: the selected session's)
|
|
45
46
|
* @returns Status response with daemon and session information
|
|
46
47
|
* @throws Error if connection fails or times out
|
|
47
48
|
*
|
|
@@ -54,9 +55,9 @@ async function assertResponsive() {
|
|
|
54
55
|
* }
|
|
55
56
|
* ```
|
|
56
57
|
*/
|
|
57
|
-
export async function getStatus() {
|
|
58
|
+
export async function getStatus(socketPath) {
|
|
58
59
|
const request = withSession({ type: 'status_request' });
|
|
59
|
-
return sendRequest(request, 'status', 'status_response', getQuickIPCRequestTimeout());
|
|
60
|
+
return sendRequest(request, 'status', 'status_response', getQuickIPCRequestTimeout(), socketPath);
|
|
60
61
|
}
|
|
61
62
|
/**
|
|
62
63
|
* Request preview data from the daemon.
|
|
@@ -145,6 +146,8 @@ export async function startSession(url, options) {
|
|
|
145
146
|
headless: options.headless,
|
|
146
147
|
chromeWsUrl: options.chromeWsUrl,
|
|
147
148
|
chromeFlags: options.chromeFlags,
|
|
149
|
+
viewport: options.viewport,
|
|
150
|
+
colorScheme: options.colorScheme,
|
|
148
151
|
}),
|
|
149
152
|
});
|
|
150
153
|
await assertResponsive();
|
|
@@ -318,4 +321,20 @@ export async function domFormDiscover() {
|
|
|
318
321
|
export async function domListeners(params) {
|
|
319
322
|
return sendCommand('dom_listeners', params);
|
|
320
323
|
}
|
|
324
|
+
/** Positions, sizes and visibility of elements. */
|
|
325
|
+
export async function domLayout(params) {
|
|
326
|
+
return sendCommand('dom_layout', params);
|
|
327
|
+
}
|
|
328
|
+
/** Time the client gives `dom wait` beyond its --timeout (the daemon reports the timeout first) */
|
|
329
|
+
const WAIT_IPC_MARGIN_MS = 10_000;
|
|
330
|
+
/**
|
|
331
|
+
* Wait until elements appear, become visible, contain a text or are gone,
|
|
332
|
+
* and/or the page has loaded.
|
|
333
|
+
*
|
|
334
|
+
* @param params - Condition and timeout
|
|
335
|
+
* @returns What the page showed once the condition was met
|
|
336
|
+
*/
|
|
337
|
+
export async function domWait(params) {
|
|
338
|
+
return sendCommand('dom_wait', params, Math.max(getIPCRequestTimeout(), params.timeout + WAIT_IPC_MARGIN_MS));
|
|
339
|
+
}
|
|
321
340
|
//# sourceMappingURL=client.js.map
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Each command has a request schema (input) and response data schema (output).
|
|
6
6
|
*/
|
|
7
7
|
import type { HintDetails } from '../../errors/notices.js';
|
|
8
|
-
import type { ClickResult, FillResult, ListenersResult, PressKeyResult, RawFormData, ScrollResult, SubmitResult } from './domTypes.js';
|
|
8
|
+
import type { ClickResult, FillResult, LayoutResult, ListenersResult, PressKeyResult, RawFormData, ScrollResult, SubmitResult } from './domTypes.js';
|
|
9
9
|
import type { PageState, SessionActivity } from '../session/types.js';
|
|
10
10
|
import type { NetworkRequest } from '../../types.js';
|
|
11
11
|
/**
|
|
@@ -147,6 +147,14 @@ export interface SessionNetworkHeadersData {
|
|
|
147
147
|
url: string;
|
|
148
148
|
/** Request ID for correlation with peek output. */
|
|
149
149
|
requestId: string;
|
|
150
|
+
/** HTTP method. */
|
|
151
|
+
method?: string;
|
|
152
|
+
/** HTTP status (0: failed without a response; missing while pending). */
|
|
153
|
+
status?: number;
|
|
154
|
+
/** Status text sent by the server (empty for HTTP/2). */
|
|
155
|
+
statusText?: string;
|
|
156
|
+
/** Why loading failed, when it did. */
|
|
157
|
+
errorText?: string;
|
|
150
158
|
/** Request headers. */
|
|
151
159
|
requestHeaders: Record<string, string>;
|
|
152
160
|
/** Response headers. */
|
|
@@ -167,7 +175,7 @@ export interface DomEvalData {
|
|
|
167
175
|
type: string;
|
|
168
176
|
/** Object subtype (node, date, array, ...) */
|
|
169
177
|
subtype?: string;
|
|
170
|
-
/** URL of the iframe the script ran in (with `frame
|
|
178
|
+
/** URL of the iframe the script ran in (with `frame`; empty when it has none) */
|
|
171
179
|
frame?: string;
|
|
172
180
|
}
|
|
173
181
|
/** An iframe of the page, as listed by `bdg dom frames` */
|
|
@@ -180,12 +188,18 @@ export interface DomFrame {
|
|
|
180
188
|
name?: string;
|
|
181
189
|
/** `id` attribute of the iframe element */
|
|
182
190
|
id?: string;
|
|
183
|
-
/**
|
|
191
|
+
/**
|
|
192
|
+
* Origin the frame's scripts run with: inherited from the parent for
|
|
193
|
+
* srcdoc and about:blank, `"null"` (opaque) for data: URLs and sandboxes
|
|
194
|
+
* without allow-same-origin
|
|
195
|
+
*/
|
|
184
196
|
origin: string;
|
|
185
|
-
/**
|
|
197
|
+
/** The page cannot reach its document: the origin differs from the page's, or is opaque */
|
|
186
198
|
crossOrigin: boolean;
|
|
187
199
|
/** Runs in its own renderer process (site isolation) */
|
|
188
200
|
outOfProcess: boolean;
|
|
201
|
+
/** Index of the frame it is nested in (missing for frames of the page itself) */
|
|
202
|
+
parentIndex?: number;
|
|
189
203
|
}
|
|
190
204
|
/**
|
|
191
205
|
* dom_frames: list the page's iframes (including nested and out-of-process ones).
|
|
@@ -276,8 +290,21 @@ export interface DomListenersCommand {
|
|
|
276
290
|
backendNodeId?: number;
|
|
277
291
|
/** Only these event types (default: all) */
|
|
278
292
|
types?: string[];
|
|
293
|
+
/** List every listener of framework roots instead of one summary per node */
|
|
294
|
+
all?: boolean;
|
|
279
295
|
}
|
|
280
296
|
export type DomListenersData = ListenersResult;
|
|
297
|
+
/**
|
|
298
|
+
* dom_layout: positions, sizes and visibility of elements.
|
|
299
|
+
*/
|
|
300
|
+
export interface DomLayoutCommand {
|
|
301
|
+
selector: string;
|
|
302
|
+
/** Only this match (default: every match) */
|
|
303
|
+
index?: number;
|
|
304
|
+
/** Exact element from the query cache (overrides selector/index) */
|
|
305
|
+
backendNodeId?: number;
|
|
306
|
+
}
|
|
307
|
+
export type DomLayoutData = LayoutResult;
|
|
281
308
|
/**
|
|
282
309
|
* dom_form_discover: run the form discovery script and return raw form data.
|
|
283
310
|
*/
|
|
@@ -309,6 +336,8 @@ export type RegistryShape = {
|
|
|
309
336
|
dom_scroll: CommandDef<DomScrollCommand, DomScrollData>;
|
|
310
337
|
dom_form_discover: CommandDef<DomFormDiscoverCommand, DomFormDiscoverData>;
|
|
311
338
|
dom_listeners: CommandDef<DomListenersCommand, DomListenersData>;
|
|
339
|
+
dom_layout: CommandDef<DomLayoutCommand, DomLayoutData>;
|
|
340
|
+
dom_wait: CommandDef<DomWaitCommand, DomWaitData>;
|
|
312
341
|
page_navigate: CommandDef<PageNavigateCommand, PageNavigationResult>;
|
|
313
342
|
};
|
|
314
343
|
/** What `bdg page` does */
|
|
@@ -325,6 +354,62 @@ export interface PageNavigationResult {
|
|
|
325
354
|
status?: number;
|
|
326
355
|
/** Something worth knowing: an HTTP error, a download, a page still loading */
|
|
327
356
|
warning?: string;
|
|
357
|
+
/** The new document had not finished loading within the wait (absent once complete) */
|
|
358
|
+
loading?: PageLoadingState;
|
|
359
|
+
}
|
|
360
|
+
/** A request the page is still waiting for */
|
|
361
|
+
export interface PendingRequestInfo {
|
|
362
|
+
method: string;
|
|
363
|
+
url: string;
|
|
364
|
+
/** CDP resource type (Script, Stylesheet, Image, ...) when known */
|
|
365
|
+
resourceType?: string;
|
|
366
|
+
/** How long it has been running */
|
|
367
|
+
pendingMs: number;
|
|
368
|
+
}
|
|
369
|
+
/** A document that has not finished loading (`document.readyState` is not `complete`) */
|
|
370
|
+
export interface PageLoadingState {
|
|
371
|
+
/** `loading` or `interactive` */
|
|
372
|
+
readyState: string;
|
|
373
|
+
/** The longest-running requests, load-blocking ones (scripts, styles, images, frames) first */
|
|
374
|
+
pending: PendingRequestInfo[];
|
|
375
|
+
/** All requests still running (more than `pending` lists when there are many) */
|
|
376
|
+
pendingCount: number;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* dom_wait: wait until elements matching a selector appear, become visible,
|
|
380
|
+
* contain a text or are gone, and/or the page has loaded.
|
|
381
|
+
*/
|
|
382
|
+
export interface DomWaitCommand {
|
|
383
|
+
/** Selector (filters like :has-text and :visible allowed); optional with `load` */
|
|
384
|
+
selector?: string;
|
|
385
|
+
/** Text one of the matches must contain (case-insensitive) */
|
|
386
|
+
text?: string;
|
|
387
|
+
/** Wait for the matches (or visible matches with `visible`) to be gone */
|
|
388
|
+
gone?: boolean;
|
|
389
|
+
/** Only count visible matches */
|
|
390
|
+
visible?: boolean;
|
|
391
|
+
/** Also wait for `document.readyState` to be `complete` */
|
|
392
|
+
load?: boolean;
|
|
393
|
+
/** Give up after this many milliseconds */
|
|
394
|
+
timeout: number;
|
|
395
|
+
}
|
|
396
|
+
/** What the page showed when a `dom wait` condition was met */
|
|
397
|
+
export interface DomWaitData {
|
|
398
|
+
selector?: string;
|
|
399
|
+
text?: string;
|
|
400
|
+
gone?: boolean;
|
|
401
|
+
visible?: boolean;
|
|
402
|
+
load?: boolean;
|
|
403
|
+
/** Time from the start of the wait until the condition was met */
|
|
404
|
+
elapsedMs: number;
|
|
405
|
+
/** Elements matching the selector */
|
|
406
|
+
count: number;
|
|
407
|
+
/** Of those, the ones containing `text` (with `text` only) */
|
|
408
|
+
textCount?: number;
|
|
409
|
+
/** Of those (or of the text matches), the visible ones */
|
|
410
|
+
visibleCount: number;
|
|
411
|
+
/** `document.readyState` of the page */
|
|
412
|
+
readyState: string;
|
|
328
413
|
}
|
|
329
414
|
/**
|
|
330
415
|
* page_navigate: navigate, reload, or go back/forward, then wait for the page.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* CLI commands and IPC transport consume them directly. Keeping the contract
|
|
7
7
|
* here lets runtime and transport evolve independently.
|
|
8
8
|
*/
|
|
9
|
-
import type { FormStep, FieldOption } from '../../types.js';
|
|
9
|
+
import type { FormStep, FieldOption, ViewportPosition } from '../../types.js';
|
|
10
10
|
/**
|
|
11
11
|
* A JavaScript dialog (alert, confirm, prompt, beforeunload) that bdg accepted
|
|
12
12
|
* while a command ran.
|
|
@@ -17,20 +17,96 @@ export interface DialogInfo {
|
|
|
17
17
|
/** Text the page showed */
|
|
18
18
|
message: string;
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* A network request that started while a command ran (after the action began
|
|
22
|
+
* and before the command returned).
|
|
23
|
+
*/
|
|
24
|
+
export interface TriggeredRequest {
|
|
25
|
+
/** Request id (what `bdg details network <id>` takes) */
|
|
26
|
+
requestId: string;
|
|
27
|
+
method: string;
|
|
28
|
+
url: string;
|
|
29
|
+
/** CDP resource type, e.g. `Document`, `Fetch`, `Stylesheet` */
|
|
30
|
+
resourceType?: string;
|
|
31
|
+
/** HTTP status, once a response arrived */
|
|
32
|
+
status?: number;
|
|
33
|
+
/** How long it took, once it finished or failed */
|
|
34
|
+
durationMs?: number;
|
|
35
|
+
/** Set when it failed without a response (DNS, refused, aborted, blocked) */
|
|
36
|
+
failed?: true;
|
|
37
|
+
/** Why it failed (also set when loading failed after the response) */
|
|
38
|
+
errorText?: string;
|
|
39
|
+
/** Set when it was still running when the command returned */
|
|
40
|
+
pending?: true;
|
|
41
|
+
/**
|
|
42
|
+
* Set when the response arrived but its body was still loading when the
|
|
43
|
+
* command returned (a stream such as EventSource, a slow download)
|
|
44
|
+
*/
|
|
45
|
+
loading?: true;
|
|
46
|
+
}
|
|
47
|
+
/** How the page changed location during an action */
|
|
48
|
+
export interface PageNavigation {
|
|
49
|
+
/** URL the page shows after the action */
|
|
50
|
+
url: string;
|
|
51
|
+
/** True for a same-document change (history API, hash); false for a new document */
|
|
52
|
+
sameDocument: boolean;
|
|
53
|
+
/** HTTP status of the new document, when known */
|
|
54
|
+
status?: number;
|
|
55
|
+
}
|
|
56
|
+
/** A message (alert, status, flash, error text) the page showed during an action */
|
|
57
|
+
export interface NewMessage {
|
|
58
|
+
/** Its visible text (close buttons and aria-hidden parts left out), at most 120 characters */
|
|
59
|
+
text: string;
|
|
60
|
+
/** The element showing it, e.g. `div#flash.flash.error` */
|
|
61
|
+
element: string;
|
|
62
|
+
}
|
|
63
|
+
/** What an action changed on the page, besides its triggered requests */
|
|
64
|
+
export interface ActionEffects {
|
|
65
|
+
/** The page navigated or changed its URL (absent when it did not) */
|
|
66
|
+
navigation?: PageNavigation;
|
|
67
|
+
/** Messages that appeared or changed (at most 3; absent when none did) */
|
|
68
|
+
messages?: NewMessage[];
|
|
69
|
+
/** "none" when the action had no visible effect: no DOM change, request or navigation */
|
|
70
|
+
effect?: 'none';
|
|
71
|
+
}
|
|
72
|
+
/** A filled field's value differing from the one given */
|
|
73
|
+
export interface FillValueMismatch {
|
|
74
|
+
/** Value given (for a select: the chosen option's value; checkboxes: checked/unchecked) */
|
|
75
|
+
expected: string;
|
|
76
|
+
/** Value the field has after filling */
|
|
77
|
+
actual: string;
|
|
78
|
+
/** Set when the page cut the value to the field's maxlength */
|
|
79
|
+
truncatedTo?: number;
|
|
80
|
+
/** Password fields (values masked): length of the value given */
|
|
81
|
+
expectedLength?: number;
|
|
82
|
+
/** Password fields (values masked): length of the field's value */
|
|
83
|
+
actualLength?: number;
|
|
84
|
+
/** Another field of the form that holds the value given, e.g. `input#first-name` */
|
|
85
|
+
movedTo?: string;
|
|
86
|
+
}
|
|
20
87
|
/**
|
|
21
88
|
* Result of filling an element.
|
|
22
89
|
*/
|
|
23
|
-
export interface FillResult {
|
|
90
|
+
export interface FillResult extends ActionEffects {
|
|
24
91
|
success: boolean;
|
|
25
92
|
error?: string;
|
|
26
93
|
selector?: string;
|
|
27
94
|
value?: string;
|
|
95
|
+
/** The element acted on, e.g. `input.toggle in div.view "Write report"` */
|
|
96
|
+
element?: string;
|
|
28
97
|
elementType?: string;
|
|
29
98
|
inputType?: string | null;
|
|
30
99
|
checked?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Set when the field's value read back after filling is not the one given
|
|
102
|
+
* (the page rejected, reformatted or moved it; passwords masked)
|
|
103
|
+
*/
|
|
104
|
+
valueMismatch?: FillValueMismatch;
|
|
31
105
|
suggestion?: string;
|
|
32
106
|
/** Set when the target is a file input (filled through CDP instead) */
|
|
33
107
|
fileInput?: boolean;
|
|
108
|
+
/** Set when the target is not a field (nor a label of one): a list from another command was likely meant */
|
|
109
|
+
unsuitableElement?: boolean;
|
|
34
110
|
/** Something the page will likely object to (e.g. a value above max) */
|
|
35
111
|
warning?: string;
|
|
36
112
|
/** Elements the selector matched */
|
|
@@ -38,14 +114,20 @@ export interface FillResult {
|
|
|
38
114
|
exitCode?: number;
|
|
39
115
|
/** Dialogs accepted while the command ran */
|
|
40
116
|
dialogs?: DialogInfo[];
|
|
117
|
+
/** Requests the action triggered (absent when network telemetry is off) */
|
|
118
|
+
triggeredRequests?: TriggeredRequest[];
|
|
119
|
+
/** Requests left out of `triggeredRequests` (it lists the first 50) */
|
|
120
|
+
triggeredRequestsOmitted?: number;
|
|
41
121
|
}
|
|
42
122
|
/**
|
|
43
123
|
* Result of clicking an element.
|
|
44
124
|
*/
|
|
45
|
-
export interface ClickResult {
|
|
125
|
+
export interface ClickResult extends ActionEffects {
|
|
46
126
|
success: boolean;
|
|
47
127
|
error?: string;
|
|
48
128
|
selector?: string;
|
|
129
|
+
/** The element acted on, e.g. `input.toggle in div.view "Write report"` */
|
|
130
|
+
element?: string;
|
|
49
131
|
elementType?: string;
|
|
50
132
|
matchCount?: number;
|
|
51
133
|
selectedIndex?: number;
|
|
@@ -61,14 +143,20 @@ export interface ClickResult {
|
|
|
61
143
|
warning?: string;
|
|
62
144
|
/** Dialogs accepted while the command ran */
|
|
63
145
|
dialogs?: DialogInfo[];
|
|
146
|
+
/** Requests the action triggered (absent when network telemetry is off) */
|
|
147
|
+
triggeredRequests?: TriggeredRequest[];
|
|
148
|
+
/** Requests left out of `triggeredRequests` (it lists the first 50) */
|
|
149
|
+
triggeredRequestsOmitted?: number;
|
|
64
150
|
}
|
|
65
151
|
/**
|
|
66
152
|
* Result of pressing a key on an element.
|
|
67
153
|
*/
|
|
68
|
-
export interface PressKeyResult {
|
|
154
|
+
export interface PressKeyResult extends ActionEffects {
|
|
69
155
|
success: boolean;
|
|
70
156
|
error?: string;
|
|
71
157
|
selector?: string;
|
|
158
|
+
/** The element acted on, e.g. `input.toggle in div.view "Write report"` */
|
|
159
|
+
element?: string;
|
|
72
160
|
key?: string;
|
|
73
161
|
times?: number;
|
|
74
162
|
/** Modifier keys held, e.g. ["Ctrl", "Shift"] */
|
|
@@ -82,17 +170,23 @@ export interface PressKeyResult {
|
|
|
82
170
|
warning?: string;
|
|
83
171
|
/** Dialogs accepted while the command ran */
|
|
84
172
|
dialogs?: DialogInfo[];
|
|
173
|
+
/** Requests the action triggered (absent when network telemetry is off) */
|
|
174
|
+
triggeredRequests?: TriggeredRequest[];
|
|
175
|
+
/** Requests left out of `triggeredRequests` (it lists the first 50) */
|
|
176
|
+
triggeredRequestsOmitted?: number;
|
|
85
177
|
}
|
|
86
178
|
/**
|
|
87
179
|
* Result of a scroll operation.
|
|
88
180
|
*/
|
|
89
|
-
export interface ScrollResult {
|
|
181
|
+
export interface ScrollResult extends ActionEffects {
|
|
90
182
|
success: boolean;
|
|
91
183
|
error?: string;
|
|
92
184
|
suggestion?: string;
|
|
93
185
|
exitCode?: number;
|
|
94
186
|
scrollType: 'element' | 'position' | 'offset';
|
|
95
187
|
selector?: string;
|
|
188
|
+
/** The element acted on, e.g. `input.toggle in div.view "Write report"` */
|
|
189
|
+
element?: string;
|
|
96
190
|
scrolledTo?: {
|
|
97
191
|
x: number;
|
|
98
192
|
y: number;
|
|
@@ -113,22 +207,36 @@ export interface ScrollResult {
|
|
|
113
207
|
matchCount?: number;
|
|
114
208
|
/** Set when the selector matched several elements */
|
|
115
209
|
warning?: string;
|
|
210
|
+
/** Requests the action triggered (absent when network telemetry is off) */
|
|
211
|
+
triggeredRequests?: TriggeredRequest[];
|
|
212
|
+
/** Requests left out of `triggeredRequests` (it lists the first 50) */
|
|
213
|
+
triggeredRequestsOmitted?: number;
|
|
116
214
|
}
|
|
117
215
|
/**
|
|
118
216
|
* Result of submitting a form.
|
|
119
217
|
*/
|
|
120
|
-
export interface SubmitResult {
|
|
218
|
+
export interface SubmitResult extends ActionEffects {
|
|
121
219
|
success: boolean;
|
|
122
220
|
error?: string;
|
|
123
221
|
selector?: string;
|
|
222
|
+
/** The element acted on, e.g. `input.toggle in div.view "Write report"` */
|
|
223
|
+
element?: string;
|
|
124
224
|
clicked?: boolean;
|
|
225
|
+
/** Set when the target is neither a form nor a button: a list from another command was likely meant */
|
|
226
|
+
unsuitableElement?: boolean;
|
|
125
227
|
networkRequests?: number;
|
|
126
228
|
navigationOccurred?: boolean;
|
|
127
229
|
waitTimeMs?: number;
|
|
230
|
+
/** Set when the page loaded but its requests had not finished by the timeout */
|
|
231
|
+
warning?: string;
|
|
128
232
|
suggestion?: string;
|
|
129
233
|
exitCode?: number;
|
|
130
234
|
/** Dialogs accepted while the command ran */
|
|
131
235
|
dialogs?: DialogInfo[];
|
|
236
|
+
/** Requests the action triggered (absent when network telemetry is off) */
|
|
237
|
+
triggeredRequests?: TriggeredRequest[];
|
|
238
|
+
/** Requests left out of `triggeredRequests` (it lists the first 50) */
|
|
239
|
+
triggeredRequestsOmitted?: number;
|
|
132
240
|
}
|
|
133
241
|
/** Where an event listener is attached, seen from the inspected element. */
|
|
134
242
|
export type ListenerPlacement = 'target' | 'ancestor' | 'document' | 'window';
|
|
@@ -157,6 +265,40 @@ export interface ElementListener {
|
|
|
157
265
|
passive: boolean;
|
|
158
266
|
once: boolean;
|
|
159
267
|
handler: ListenerHandler;
|
|
268
|
+
/** The handler does nothing (an empty function, like React's `onclick` placeholder) */
|
|
269
|
+
noop?: true;
|
|
270
|
+
/**
|
|
271
|
+
* Registered through this framework; `handler` is the real handler, not
|
|
272
|
+
* the framework's dispatcher. React handlers are `on…` props of the node
|
|
273
|
+
* (`reactProp`), run by React's dispatchers on its root container.
|
|
274
|
+
*/
|
|
275
|
+
framework?: 'jQuery' | 'React';
|
|
276
|
+
/** React prop the handler is set as, e.g. `onClick`, `onClickCapture` */
|
|
277
|
+
reactProp?: string;
|
|
278
|
+
/** jQuery delegate selector (`.on(type, selector, fn)`) the element matched */
|
|
279
|
+
delegateSelector?: string;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Listeners of one node collapsed into a summary: a framework root (React's
|
|
283
|
+
* root container) registers the same few dispatchers for dozens of event types.
|
|
284
|
+
*/
|
|
285
|
+
export interface CollapsedListeners {
|
|
286
|
+
/** Where the listeners are attached */
|
|
287
|
+
on: ListenerPlacement;
|
|
288
|
+
/** The node or object they are attached to, e.g. `div#__next` */
|
|
289
|
+
node: string;
|
|
290
|
+
/** Framework recognised on the node, e.g. `React root` */
|
|
291
|
+
framework?: string;
|
|
292
|
+
/** Event types, alphabetically */
|
|
293
|
+
types: string[];
|
|
294
|
+
/** Number of listeners collapsed */
|
|
295
|
+
count: number;
|
|
296
|
+
/** Some listen in the capture phase */
|
|
297
|
+
capture: boolean;
|
|
298
|
+
/** Some listen in the bubble phase */
|
|
299
|
+
bubble: boolean;
|
|
300
|
+
/** The distinct dispatcher functions */
|
|
301
|
+
handlers: ListenerHandler[];
|
|
160
302
|
}
|
|
161
303
|
/**
|
|
162
304
|
* Event listeners of an element, its ancestors, its document and window,
|
|
@@ -172,11 +314,106 @@ export interface ListenersResult {
|
|
|
172
314
|
/** The inspected element, e.g. `button#save` */
|
|
173
315
|
element: string;
|
|
174
316
|
listeners: ElementListener[];
|
|
317
|
+
/** Framework root listeners, one entry per node (missing with `all`) */
|
|
318
|
+
collapsed?: CollapsedListeners[];
|
|
319
|
+
/** The iframe element whose document holds the element, e.g. `iframe#checkout` */
|
|
320
|
+
frame?: string;
|
|
321
|
+
/** jQuery handlers not resolved (over 50 per call): their dispatcher is listed instead */
|
|
322
|
+
jqueryHandlersSkipped?: number;
|
|
323
|
+
/** React `on…` props not resolved (over 50 per call) */
|
|
324
|
+
reactHandlersSkipped?: number;
|
|
325
|
+
/** Event types with listeners close to the requested ones, when none matched (`Click` → `click`) */
|
|
326
|
+
typeSuggestions?: string[];
|
|
175
327
|
/** Elements the selector matched */
|
|
176
328
|
matchCount?: number;
|
|
177
329
|
/** Set when several elements matched and no --index was given */
|
|
178
330
|
warning?: string;
|
|
179
331
|
}
|
|
332
|
+
/** A point in CSS pixels. */
|
|
333
|
+
export interface LayoutPoint {
|
|
334
|
+
x: number;
|
|
335
|
+
y: number;
|
|
336
|
+
}
|
|
337
|
+
/** A width and height in CSS pixels. */
|
|
338
|
+
export interface LayoutSize {
|
|
339
|
+
width: number;
|
|
340
|
+
height: number;
|
|
341
|
+
}
|
|
342
|
+
/** Position and size of an element's border box in CSS pixels. */
|
|
343
|
+
export type LayoutBox = LayoutPoint & LayoutSize;
|
|
344
|
+
/** Computed styles that decide whether and how an element shows. */
|
|
345
|
+
export interface LayoutComputedStyle {
|
|
346
|
+
display: string;
|
|
347
|
+
visibility: string;
|
|
348
|
+
position: string;
|
|
349
|
+
opacity: string;
|
|
350
|
+
zIndex: string;
|
|
351
|
+
}
|
|
352
|
+
/** Where one element is on the page and whether a user can see it. */
|
|
353
|
+
export interface ElementLayout {
|
|
354
|
+
/** Index among the selector's matches (or in the cached query) */
|
|
355
|
+
index: number;
|
|
356
|
+
tag: string;
|
|
357
|
+
/** Short description, e.g. `button#save.primary` */
|
|
358
|
+
element: string;
|
|
359
|
+
/** Text preview */
|
|
360
|
+
text?: string;
|
|
361
|
+
/** Enclosing iframe(s) and shadow root, e.g. `iframe#pay > shadow root of <x-card>` */
|
|
362
|
+
context?: string;
|
|
363
|
+
/** Border box relative to the top-level document (page coordinates) */
|
|
364
|
+
bounds: LayoutBox;
|
|
365
|
+
/** Top-left corner relative to the top-level viewport */
|
|
366
|
+
viewport: LayoutPoint;
|
|
367
|
+
inViewport: ViewportPosition;
|
|
368
|
+
/** Share of the element in view, for `partly` */
|
|
369
|
+
percentVisible?: number;
|
|
370
|
+
/** Why it is `hidden`, e.g. `display: none` */
|
|
371
|
+
hiddenReason?: string;
|
|
372
|
+
/**
|
|
373
|
+
* Page scroll (`window.scrollBy`) that shows all of it, when the page can
|
|
374
|
+
* scroll there: for a `partly` visible element the smallest such scroll (the
|
|
375
|
+
* part cut off at the edge; the start of one larger than the viewport), for
|
|
376
|
+
* one out of view the scroll centring it (as `dom scroll <selector>` does)
|
|
377
|
+
*/
|
|
378
|
+
scrollBy?: LayoutPoint;
|
|
379
|
+
/** Ancestor or iframe cutting it off (scroll that container instead of the page) */
|
|
380
|
+
clippedBy?: string;
|
|
381
|
+
/** Why page scroll cannot bring it fully into view: it is fixed, or beyond the page's scroll range */
|
|
382
|
+
offScreenReason?: string;
|
|
383
|
+
/** Topmost element at the center of its visible part, when that is another element */
|
|
384
|
+
coveredBy?: string;
|
|
385
|
+
/**
|
|
386
|
+
* Why it cannot be seen although it is rendered: `opacity: 0` on it or an
|
|
387
|
+
* ancestor, or a `clip-path`/`clip` that cuts it away entirely, e.g.
|
|
388
|
+
* `opacity: 0 on div#menu` (`inViewport` still says where it is)
|
|
389
|
+
*/
|
|
390
|
+
invisible?: string;
|
|
391
|
+
/** Inside an `inert` element: shown, but a user cannot interact with it */
|
|
392
|
+
inert?: true;
|
|
393
|
+
computed: LayoutComputedStyle;
|
|
394
|
+
}
|
|
395
|
+
/** Viewport, scroll position and document size of the top-level page. */
|
|
396
|
+
export interface PageLayout {
|
|
397
|
+
/** Layout viewport without scrollbars (as `dom scroll` reports it) */
|
|
398
|
+
viewport: LayoutSize;
|
|
399
|
+
scroll: LayoutPoint;
|
|
400
|
+
document: LayoutSize;
|
|
401
|
+
/** `prefers-color-scheme` the page sees (the system's unless `--color-scheme` was given at start) */
|
|
402
|
+
colorScheme?: 'light' | 'dark';
|
|
403
|
+
}
|
|
404
|
+
/** Layout of the elements a selector (or cached index) refers to. */
|
|
405
|
+
export interface LayoutResult {
|
|
406
|
+
/** Always true: failures are reported as errors */
|
|
407
|
+
success: true;
|
|
408
|
+
/** Selector the elements were found with (for an index: the cached query's) */
|
|
409
|
+
selector: string;
|
|
410
|
+
/** Elements the selector matched (1 for an index) */
|
|
411
|
+
count: number;
|
|
412
|
+
page: PageLayout;
|
|
413
|
+
elements: ElementLayout[];
|
|
414
|
+
/** Matches left out of `elements` (beyond the limit) */
|
|
415
|
+
omitted?: number;
|
|
416
|
+
}
|
|
180
417
|
/**
|
|
181
418
|
* Raw form data returned from the page-context form-discovery script.
|
|
182
419
|
*/
|
|
@@ -186,6 +423,8 @@ export interface RawFormData {
|
|
|
186
423
|
frameForms?: Array<{
|
|
187
424
|
url: string;
|
|
188
425
|
}>;
|
|
426
|
+
/** The page's `document.readyState` when the forms were read */
|
|
427
|
+
readyState?: string;
|
|
189
428
|
}
|
|
190
429
|
export interface RawForm {
|
|
191
430
|
index: number;
|
|
@@ -194,6 +433,10 @@ export interface RawForm {
|
|
|
194
433
|
method: string;
|
|
195
434
|
step: FormStep | null;
|
|
196
435
|
relevanceScore: number;
|
|
436
|
+
/** Not rendered (or visibility-hidden), or all its fields are */
|
|
437
|
+
hidden?: boolean;
|
|
438
|
+
/** Shown inside an open dialog (`dialog[open]`, `aria-modal`, a dialog role) */
|
|
439
|
+
inDialog?: boolean;
|
|
197
440
|
inIframe: boolean;
|
|
198
441
|
iframeUrl?: string;
|
|
199
442
|
crossOrigin?: boolean;
|
|
@@ -209,7 +452,10 @@ export interface RawField {
|
|
|
209
452
|
label: string;
|
|
210
453
|
name: string | null;
|
|
211
454
|
placeholder?: string;
|
|
455
|
+
/** `required`, aria-required, or a label marked with an asterisk */
|
|
212
456
|
required: boolean;
|
|
457
|
+
/** Name of the radio/checkbox group (legend, radiogroup label or name) */
|
|
458
|
+
groupLabel?: string;
|
|
213
459
|
disabled: boolean;
|
|
214
460
|
readOnly: boolean;
|
|
215
461
|
hidden: boolean;
|
|
@@ -231,6 +477,11 @@ export interface RawButton {
|
|
|
231
477
|
label: string;
|
|
232
478
|
type: string;
|
|
233
479
|
disabled: boolean;
|
|
234
|
-
|
|
480
|
+
/** A submit button by markup: `<input type=submit>` or `type="submit"` written out */
|
|
481
|
+
explicitSubmit: boolean;
|
|
482
|
+
/** A `<button>` without a type in a form: submits it, like Enter does */
|
|
483
|
+
formDefault: boolean;
|
|
484
|
+
/** Has a class like `primary`, `btn-primary` or `submit` */
|
|
485
|
+
primaryClass: boolean;
|
|
235
486
|
}
|
|
236
487
|
//# sourceMappingURL=domTypes.d.ts.map
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* Types for handshake, start session, and stop session operations.
|
|
5
5
|
*/
|
|
6
6
|
import type { IPCErrorCode } from './errors.js';
|
|
7
|
-
import type {
|
|
7
|
+
import type { PageLoadingState } from '../protocol/commands.js';
|
|
8
|
+
import type { ColorScheme, TelemetryType, ViewportSize } from '../../types.js';
|
|
8
9
|
/**
|
|
9
10
|
* Base message interface with type and session ID.
|
|
10
11
|
*/
|
|
@@ -53,6 +54,10 @@ export interface SessionOptions {
|
|
|
53
54
|
chromeWsUrl?: string;
|
|
54
55
|
/** Custom Chrome flags (e.g., ['--ignore-certificate-errors']). */
|
|
55
56
|
chromeFlags?: string[];
|
|
57
|
+
/** Viewport size the page is emulated at (`--viewport`). */
|
|
58
|
+
viewport?: ViewportSize;
|
|
59
|
+
/** `prefers-color-scheme` the page is emulated with (`--color-scheme`). */
|
|
60
|
+
colorScheme?: ColorScheme;
|
|
56
61
|
}
|
|
57
62
|
/**
|
|
58
63
|
* Start session request (client → daemon).
|
|
@@ -81,6 +86,8 @@ export interface StartSessionResponseData {
|
|
|
81
86
|
targetTitle?: string;
|
|
82
87
|
/** HTTP status of the page's main document, when known. */
|
|
83
88
|
documentStatus?: number;
|
|
89
|
+
/** The page had not finished loading when the start returned. */
|
|
90
|
+
loading?: PageLoadingState;
|
|
84
91
|
/** True if a stale session was auto-recovered before this one started. */
|
|
85
92
|
recovered?: boolean;
|
|
86
93
|
/** Target URL or ws URL of the stale session that was recovered, if recorded. */
|