browser-debugger-cli 0.8.0 → 0.10.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.
Files changed (304) hide show
  1. package/README.md +7 -1
  2. package/dist/cdp/schema.d.ts +4 -1
  3. package/dist/cdp/schema.js +48 -7
  4. package/dist/commands/cdp.js +3 -2
  5. package/dist/commands/cleanup.d.ts +11 -0
  6. package/dist/commands/cleanup.js +161 -57
  7. package/dist/commands/console.d.ts +20 -1
  8. package/dist/commands/console.js +57 -17
  9. package/dist/commands/details.js +3 -2
  10. package/dist/commands/dom/DomElementResolver.d.ts +10 -3
  11. package/dist/commands/dom/DomElementResolver.js +35 -17
  12. package/dist/commands/dom/a11y.d.ts +10 -0
  13. package/dist/commands/dom/a11y.js +29 -6
  14. package/dist/commands/dom/eval.d.ts +3 -1
  15. package/dist/commands/dom/eval.js +29 -4
  16. package/dist/commands/dom/form.js +16 -62
  17. package/dist/commands/dom/formInteraction.js +189 -119
  18. package/dist/commands/dom/formSummary.d.ts +49 -0
  19. package/dist/commands/dom/formSummary.js +180 -0
  20. package/dist/commands/dom/frames.d.ts +2 -1
  21. package/dist/commands/dom/frames.js +17 -2
  22. package/dist/commands/dom/get.d.ts +6 -5
  23. package/dist/commands/dom/get.js +92 -82
  24. package/dist/commands/dom/helpers/index.d.ts +1 -1
  25. package/dist/commands/dom/helpers/index.js +1 -1
  26. package/dist/commands/dom/helpers/keyAttributes.d.ts +20 -0
  27. package/dist/commands/dom/helpers/keyAttributes.js +54 -0
  28. package/dist/commands/dom/helpers/query.d.ts +44 -17
  29. package/dist/commands/dom/helpers/query.js +300 -106
  30. package/dist/commands/dom/helpers/runElementCommand.d.ts +10 -2
  31. package/dist/commands/dom/helpers/runElementCommand.js +98 -30
  32. package/dist/commands/dom/helpers/screenshot.d.ts +4 -1
  33. package/dist/commands/dom/helpers/screenshot.js +239 -51
  34. package/dist/commands/dom/index.d.ts +4 -1
  35. package/dist/commands/dom/index.js +22 -7
  36. package/dist/commands/dom/inspect.d.ts +15 -0
  37. package/dist/commands/dom/inspect.js +82 -0
  38. package/dist/commands/dom/layout.d.ts +14 -0
  39. package/dist/commands/dom/layout.js +54 -0
  40. package/dist/commands/dom/listeners.d.ts +5 -1
  41. package/dist/commands/dom/listeners.js +15 -5
  42. package/dist/commands/dom/query.js +2 -3
  43. package/dist/commands/dom/screenshot.d.ts +12 -2
  44. package/dist/commands/dom/screenshot.js +27 -3
  45. package/dist/commands/dom/semanticUtils.d.ts +16 -10
  46. package/dist/commands/dom/semanticUtils.js +53 -16
  47. package/dist/commands/dom/wait.d.ts +13 -0
  48. package/dist/commands/dom/wait.js +83 -0
  49. package/dist/commands/helpJson.js +2 -2
  50. package/dist/commands/network/list.js +17 -13
  51. package/dist/commands/optionBehaviors.js +154 -21
  52. package/dist/commands/page.d.ts +3 -2
  53. package/dist/commands/page.js +100 -5
  54. package/dist/commands/peek.js +4 -11
  55. package/dist/commands/sessions.d.ts +8 -0
  56. package/dist/commands/sessions.js +19 -0
  57. package/dist/commands/shared/CommandRunner.js +4 -4
  58. package/dist/commands/shared/commonOptions.d.ts +4 -0
  59. package/dist/commands/shared/commonOptions.js +9 -0
  60. package/dist/commands/shared/dataFetcher.js +2 -2
  61. package/dist/commands/shared/followMode.d.ts +21 -1
  62. package/dist/commands/shared/followMode.js +29 -2
  63. package/dist/commands/shared/handleValidationError.d.ts +2 -2
  64. package/dist/commands/shared/handleValidationError.js +12 -3
  65. package/dist/commands/shared/optionTypes.d.ts +61 -5
  66. package/dist/commands/shared/startHelpers.d.ts +66 -0
  67. package/dist/commands/shared/startHelpers.js +103 -13
  68. package/dist/commands/shared/validation.d.ts +14 -2
  69. package/dist/commands/shared/validation.js +20 -3
  70. package/dist/commands/start.d.ts +63 -0
  71. package/dist/commands/start.js +115 -15
  72. package/dist/commands/status.js +29 -7
  73. package/dist/commands/stop.js +7 -6
  74. package/dist/commands/tail.js +4 -11
  75. package/dist/commands/types.d.ts +2 -0
  76. package/dist/commands.js +2 -0
  77. package/dist/connection/chromeIdentity.d.ts +65 -0
  78. package/dist/connection/chromeIdentity.js +143 -0
  79. package/dist/connection/launcher/profilePreferences.d.ts +47 -0
  80. package/dist/connection/launcher/profilePreferences.js +151 -0
  81. package/dist/connection/launcher.d.ts +21 -2
  82. package/dist/connection/launcher.js +42 -16
  83. package/dist/connection/portReservation.d.ts +14 -4
  84. package/dist/connection/portReservation.js +21 -6
  85. package/dist/connection/startupExit.d.ts +8 -0
  86. package/dist/connection/startupExit.js +15 -6
  87. package/dist/constants.d.ts +6 -2
  88. package/dist/constants.js +9 -2
  89. package/dist/daemon/SessionController.js +23 -7
  90. package/dist/daemon/errors.d.ts +1 -1
  91. package/dist/daemon/errors.js +1 -1
  92. package/dist/daemon/launcher.d.ts +10 -2
  93. package/dist/daemon/launcher.js +8 -7
  94. package/dist/daemon/server/SocketServer.js +1 -2
  95. package/dist/daemon/session/Session.d.ts +20 -0
  96. package/dist/daemon/session/Session.js +80 -9
  97. package/dist/daemon/session/chromeConnection.d.ts +9 -0
  98. package/dist/daemon/session/chromeConnection.js +45 -8
  99. package/dist/daemon/session/commandRegistry.d.ts +14 -1
  100. package/dist/daemon/session/commandRegistry.js +113 -67
  101. package/dist/daemon/session/interactions.d.ts +48 -9
  102. package/dist/daemon/session/interactions.js +46 -9
  103. package/dist/daemon/session/triggeredRequests.d.ts +67 -0
  104. package/dist/daemon/session/triggeredRequests.js +157 -0
  105. package/dist/daemon/session/types.d.ts +5 -1
  106. package/dist/daemon.js +10630 -3601
  107. package/dist/errors/messages.d.ts +456 -24
  108. package/dist/errors/messages.js +862 -67
  109. package/dist/index.js +6915 -3401
  110. package/dist/ipc/client.d.ts +21 -1
  111. package/dist/ipc/client.js +35 -3
  112. package/dist/ipc/protocol/commands.d.ts +145 -5
  113. package/dist/ipc/protocol/commands.js +4 -0
  114. package/dist/ipc/protocol/domTypes.d.ts +291 -7
  115. package/dist/ipc/protocol/inspectTypes.d.ts +388 -0
  116. package/dist/ipc/protocol/inspectTypes.js +10 -0
  117. package/dist/ipc/session/lifecycle.d.ts +8 -1
  118. package/dist/ipc/session/queries.d.ts +5 -1
  119. package/dist/ipc/session/types.d.ts +5 -0
  120. package/dist/ipc/transport/index.d.ts +2 -1
  121. package/dist/ipc/transport/index.js +2 -2
  122. package/dist/runtime/dom/actionEffects.d.ts +185 -0
  123. package/dist/runtime/dom/actionEffects.js +402 -0
  124. package/dist/runtime/dom/actionEffectsScripts.d.ts +90 -0
  125. package/dist/runtime/dom/actionEffectsScripts.js +426 -0
  126. package/dist/runtime/dom/elementGeometry.d.ts +170 -0
  127. package/dist/runtime/dom/elementGeometry.js +553 -0
  128. package/dist/runtime/dom/elementInfo.d.ts +103 -0
  129. package/dist/runtime/dom/elementInfo.js +256 -0
  130. package/dist/runtime/dom/evalHelpers.d.ts +51 -6
  131. package/dist/runtime/dom/evalHelpers.js +136 -26
  132. package/dist/runtime/dom/eventListeners.d.ts +2 -1
  133. package/dist/runtime/dom/eventListeners.js +184 -47
  134. package/dist/runtime/dom/formDiscovery.d.ts +1 -1
  135. package/dist/runtime/dom/formDiscovery.js +116 -16
  136. package/dist/runtime/dom/formFillHelpers/fill.d.ts +9 -0
  137. package/dist/runtime/dom/formFillHelpers/fill.js +178 -14
  138. package/dist/runtime/dom/formFillHelpers/index.d.ts +2 -2
  139. package/dist/runtime/dom/formFillHelpers/index.js +2 -2
  140. package/dist/runtime/dom/formFillHelpers/pressKey.js +14 -3
  141. package/dist/runtime/dom/formFillHelpers/scroll.d.ts +3 -0
  142. package/dist/runtime/dom/formFillHelpers/scroll.js +60 -18
  143. package/dist/runtime/dom/formFillHelpers/shared.d.ts +17 -0
  144. package/dist/runtime/dom/formFillHelpers/shared.js +25 -1
  145. package/dist/runtime/dom/formFillHelpers/stability.d.ts +20 -6
  146. package/dist/runtime/dom/formFillHelpers/stability.js +50 -19
  147. package/dist/runtime/dom/formSubmitHelpers.d.ts +3 -0
  148. package/dist/runtime/dom/formSubmitHelpers.js +89 -15
  149. package/dist/runtime/dom/frameLayout.d.ts +60 -0
  150. package/dist/runtime/dom/frameLayout.js +140 -0
  151. package/dist/runtime/dom/frameOrigin.d.ts +50 -0
  152. package/dist/runtime/dom/frameOrigin.js +62 -0
  153. package/dist/runtime/dom/frameScopedConnection.d.ts +92 -0
  154. package/dist/runtime/dom/frameScopedConnection.js +252 -0
  155. package/dist/runtime/dom/frameSelection.d.ts +12 -1
  156. package/dist/runtime/dom/frameSelection.js +22 -3
  157. package/dist/runtime/dom/frames.d.ts +61 -5
  158. package/dist/runtime/dom/frames.js +329 -75
  159. package/dist/runtime/dom/inspect.d.ts +28 -0
  160. package/dist/runtime/dom/inspect.js +557 -0
  161. package/dist/runtime/dom/inspectAllStyles.d.ts +62 -0
  162. package/dist/runtime/dom/inspectAllStyles.js +385 -0
  163. package/dist/runtime/dom/inspectCascade.d.ts +94 -0
  164. package/dist/runtime/dom/inspectCascade.js +371 -0
  165. package/dist/runtime/dom/inspectCascadeModel.d.ts +39 -0
  166. package/dist/runtime/dom/inspectCascadeModel.js +232 -0
  167. package/dist/runtime/dom/inspectHints.d.ts +62 -0
  168. package/dist/runtime/dom/inspectHints.js +305 -0
  169. package/dist/runtime/dom/inspectLayoutModel.d.ts +87 -0
  170. package/dist/runtime/dom/inspectLayoutModel.js +346 -0
  171. package/dist/runtime/dom/inspectModel.d.ts +74 -0
  172. package/dist/runtime/dom/inspectModel.js +184 -0
  173. package/dist/runtime/dom/inspectPaintModel.d.ts +157 -0
  174. package/dist/runtime/dom/inspectPaintModel.js +461 -0
  175. package/dist/runtime/dom/inspectRules.d.ts +37 -0
  176. package/dist/runtime/dom/inspectRules.js +101 -0
  177. package/dist/runtime/dom/inspectScripts.d.ts +132 -0
  178. package/dist/runtime/dom/inspectScripts.js +263 -0
  179. package/dist/runtime/dom/inspectTree.d.ts +40 -0
  180. package/dist/runtime/dom/inspectTree.js +134 -0
  181. package/dist/runtime/dom/inspectVariables.d.ts +33 -0
  182. package/dist/runtime/dom/inspectVariables.js +94 -0
  183. package/dist/runtime/dom/inspectWhyModel.d.ts +20 -0
  184. package/dist/runtime/dom/inspectWhyModel.js +134 -0
  185. package/dist/runtime/dom/layout.d.ts +71 -0
  186. package/dist/runtime/dom/layout.js +340 -0
  187. package/dist/runtime/dom/listenerPageScripts.d.ts +72 -0
  188. package/dist/runtime/dom/listenerPageScripts.js +365 -0
  189. package/dist/runtime/dom/listenerSummary.d.ts +136 -11
  190. package/dist/runtime/dom/listenerSummary.js +361 -22
  191. package/dist/runtime/dom/pageActivity.d.ts +41 -0
  192. package/dist/runtime/dom/pageActivity.js +123 -0
  193. package/dist/runtime/dom/reactEventHelpers.d.ts +63 -2
  194. package/dist/runtime/dom/reactEventHelpers.js +220 -41
  195. package/dist/runtime/dom/targetNode.d.ts +80 -27
  196. package/dist/runtime/dom/targetNode.js +249 -33
  197. package/dist/runtime/dom/wait.d.ts +25 -0
  198. package/dist/runtime/dom/wait.js +199 -0
  199. package/dist/runtime/dom/waitCondition.d.ts +71 -0
  200. package/dist/runtime/dom/waitCondition.js +75 -0
  201. package/dist/runtime/page/emulation.d.ts +71 -0
  202. package/dist/runtime/page/emulation.js +117 -0
  203. package/dist/runtime/page/loadingState.d.ts +36 -0
  204. package/dist/runtime/page/loadingState.js +86 -0
  205. package/dist/runtime/page/navigation.d.ts +46 -2
  206. package/dist/runtime/page/navigation.js +69 -33
  207. package/dist/session/QueryCacheManager.d.ts +11 -1
  208. package/dist/session/QueryCacheManager.js +25 -3
  209. package/dist/session/chromeOwners.d.ts +34 -0
  210. package/dist/session/chromeOwners.js +51 -0
  211. package/dist/session/cleanup/staleSession.d.ts +11 -1
  212. package/dist/session/cleanup/staleSession.js +17 -6
  213. package/dist/session/cleanup/userCommands.js +2 -4
  214. package/dist/session/metadata.d.ts +5 -1
  215. package/dist/session/metadata.js +2 -1
  216. package/dist/session/paths.d.ts +77 -3
  217. package/dist/session/paths.js +111 -5
  218. package/dist/session/port.d.ts +31 -7
  219. package/dist/session/port.js +50 -43
  220. package/dist/session/portClaims.d.ts +66 -0
  221. package/dist/session/portClaims.js +284 -0
  222. package/dist/session/sessionList.d.ts +58 -0
  223. package/dist/session/sessionList.js +199 -0
  224. package/dist/session/sessionName.d.ts +46 -0
  225. package/dist/session/sessionName.js +97 -0
  226. package/dist/telemetry/a11y.d.ts +18 -3
  227. package/dist/telemetry/a11y.js +170 -29
  228. package/dist/telemetry/console.d.ts +1 -0
  229. package/dist/telemetry/console.js +100 -5
  230. package/dist/telemetry/network.js +3 -1
  231. package/dist/telemetry/requestKinds.d.ts +32 -0
  232. package/dist/telemetry/requestKinds.js +61 -0
  233. package/dist/telemetry/requestState.d.ts +31 -0
  234. package/dist/telemetry/requestState.js +38 -0
  235. package/dist/types.d.ts +112 -3
  236. package/dist/ui/formatters/a11y.js +3 -0
  237. package/dist/ui/formatters/console/chronological.d.ts +8 -0
  238. package/dist/ui/formatters/console/chronological.js +17 -4
  239. package/dist/ui/formatters/console/json.js +3 -4
  240. package/dist/ui/formatters/console/shared.d.ts +12 -0
  241. package/dist/ui/formatters/console.d.ts +2 -2
  242. package/dist/ui/formatters/console.js +1 -1
  243. package/dist/ui/formatters/details.d.ts +8 -0
  244. package/dist/ui/formatters/details.js +61 -4
  245. package/dist/ui/formatters/dom.d.ts +27 -14
  246. package/dist/ui/formatters/dom.js +88 -59
  247. package/dist/ui/formatters/form.js +29 -18
  248. package/dist/ui/formatters/inspect.d.ts +39 -0
  249. package/dist/ui/formatters/inspect.js +596 -0
  250. package/dist/ui/formatters/keyAttributes.d.ts +19 -0
  251. package/dist/ui/formatters/keyAttributes.js +84 -0
  252. package/dist/ui/formatters/layout.d.ts +31 -0
  253. package/dist/ui/formatters/layout.js +53 -0
  254. package/dist/ui/formatters/listeners.d.ts +3 -2
  255. package/dist/ui/formatters/listeners.js +73 -9
  256. package/dist/ui/formatters/networkHeaders.d.ts +13 -0
  257. package/dist/ui/formatters/networkHeaders.js +36 -3
  258. package/dist/ui/formatters/networkList.d.ts +29 -1
  259. package/dist/ui/formatters/networkList.js +86 -20
  260. package/dist/ui/formatters/preview.js +2 -1
  261. package/dist/ui/formatters/requestStatus.d.ts +1 -17
  262. package/dist/ui/formatters/requestStatus.js +2 -30
  263. package/dist/ui/formatters/sessions.d.ts +12 -0
  264. package/dist/ui/formatters/sessions.js +40 -0
  265. package/dist/ui/formatters/status.d.ts +21 -2
  266. package/dist/ui/formatters/status.js +47 -10
  267. package/dist/ui/formatters/triggeredRequests.d.ts +36 -0
  268. package/dist/ui/formatters/triggeredRequests.js +65 -0
  269. package/dist/ui/formatting.d.ts +19 -0
  270. package/dist/ui/formatting.js +31 -36
  271. package/dist/ui/messages/chrome.d.ts +9 -0
  272. package/dist/ui/messages/chrome.js +17 -5
  273. package/dist/ui/messages/commands.d.ts +504 -14
  274. package/dist/ui/messages/commands.js +835 -21
  275. package/dist/ui/messages/consoleMessages.d.ts +10 -0
  276. package/dist/ui/messages/consoleMessages.js +17 -0
  277. package/dist/ui/messages/hints.js +2 -1
  278. package/dist/ui/messages/networkMessages.d.ts +14 -0
  279. package/dist/ui/messages/networkMessages.js +18 -0
  280. package/dist/ui/messages/preview.js +5 -4
  281. package/dist/ui/messages/session.d.ts +30 -21
  282. package/dist/ui/messages/session.js +48 -26
  283. package/dist/ui/messages/sessionCommand.d.ts +43 -0
  284. package/dist/ui/messages/sessionCommand.js +52 -0
  285. package/dist/utils/async.d.ts +17 -0
  286. package/dist/utils/async.js +36 -0
  287. package/dist/utils/color.d.ts +84 -0
  288. package/dist/utils/color.js +376 -0
  289. package/dist/utils/cssValues.d.ts +109 -0
  290. package/dist/utils/cssValues.js +236 -0
  291. package/dist/utils/http.d.ts +22 -1
  292. package/dist/utils/http.js +28 -9
  293. package/dist/utils/selectorFilters.d.ts +48 -8
  294. package/dist/utils/selectorFilters.js +296 -53
  295. package/dist/utils/shellDetection.d.ts +8 -2
  296. package/dist/utils/shellDetection.js +120 -33
  297. package/dist/utils/suggestions.d.ts +26 -0
  298. package/dist/utils/suggestions.js +73 -0
  299. package/dist/utils/taskMappings.js +10 -0
  300. package/dist/utils/url.d.ts +12 -2
  301. package/dist/utils/url.js +69 -7
  302. package/package.json +1 -1
  303. package/dist/ui/formatters/sessionFormatters.d.ts +0 -58
  304. package/dist/ui/formatters/sessionFormatters.js +0 -121
@@ -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,122 @@ 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
+ /** An element a hover or key press showed (added, or made visible) */
64
+ export interface ShownElement {
65
+ /** Its visible text, at most 120 characters */
66
+ text: string;
67
+ /** The element, e.g. `div.figcaption` */
68
+ element: string;
69
+ }
70
+ /** What the page was still working on when an action returned */
71
+ export interface PendingChanges {
72
+ /** Content requests (documents, fetch/XHR, scripts) the action started that were still running */
73
+ requests?: number;
74
+ /** A new document was still loading */
75
+ navigation?: true;
76
+ /** A loading indicator that appeared during the action and was still shown, e.g. `div#loading` */
77
+ loading?: string;
78
+ /** The DOM was still changing (several bursts of changes, the last one under 150 ms ago) */
79
+ domChanging?: true;
80
+ /** The page did not answer within 250 ms (a long-running script) */
81
+ busy?: true;
82
+ }
83
+ /** What an action changed on the page, besides its triggered requests */
84
+ export interface ActionEffects {
85
+ /** The page navigated or changed its URL (absent when it did not) */
86
+ navigation?: PageNavigation;
87
+ /** Messages that appeared or changed (at most 3; absent when none did) */
88
+ messages?: NewMessage[];
89
+ /** Elements a hover or key press showed (at most 3, outermost first; absent when none) */
90
+ shown?: ShownElement[];
91
+ /** "none" when the action had no visible effect: no DOM change, request or navigation */
92
+ effect?: 'none';
93
+ /** False when the page was still changing as the action returned (absent otherwise) */
94
+ settled?: false;
95
+ /** What the page was still working on (with `settled: false`) */
96
+ pending?: PendingChanges;
97
+ }
98
+ /** A filled field's value differing from the one given */
99
+ export interface FillValueMismatch {
100
+ /** Value given (for a select: the chosen option's value; checkboxes: checked/unchecked) */
101
+ expected: string;
102
+ /** Value the field has after filling */
103
+ actual: string;
104
+ /** Set when the page cut the value to the field's maxlength */
105
+ truncatedTo?: number;
106
+ /** Password fields (values masked): length of the value given */
107
+ expectedLength?: number;
108
+ /** Password fields (values masked): length of the field's value */
109
+ actualLength?: number;
110
+ /** Another field of the form that holds the value given, e.g. `input#first-name` */
111
+ movedTo?: string;
112
+ }
20
113
  /**
21
114
  * Result of filling an element.
22
115
  */
23
- export interface FillResult {
116
+ export interface FillResult extends ActionEffects {
24
117
  success: boolean;
25
118
  error?: string;
26
119
  selector?: string;
27
120
  value?: string;
121
+ /** The element acted on, e.g. `input.toggle in div.view "Write report"` */
122
+ element?: string;
28
123
  elementType?: string;
29
124
  inputType?: string | null;
30
125
  checked?: boolean;
126
+ /**
127
+ * Set when the field's value read back after filling is not the one given
128
+ * (the page rejected, reformatted or moved it; passwords masked)
129
+ */
130
+ valueMismatch?: FillValueMismatch;
31
131
  suggestion?: string;
32
132
  /** Set when the target is a file input (filled through CDP instead) */
33
133
  fileInput?: boolean;
134
+ /** Set when the target is not a field (nor a label of one): a list from another command was likely meant */
135
+ unsuitableElement?: boolean;
34
136
  /** Something the page will likely object to (e.g. a value above max) */
35
137
  warning?: string;
36
138
  /** Elements the selector matched */
@@ -38,14 +140,20 @@ export interface FillResult {
38
140
  exitCode?: number;
39
141
  /** Dialogs accepted while the command ran */
40
142
  dialogs?: DialogInfo[];
143
+ /** Requests the action triggered (absent when network telemetry is off) */
144
+ triggeredRequests?: TriggeredRequest[];
145
+ /** Requests left out of `triggeredRequests` (it lists the first 50) */
146
+ triggeredRequestsOmitted?: number;
41
147
  }
42
148
  /**
43
149
  * Result of clicking an element.
44
150
  */
45
- export interface ClickResult {
151
+ export interface ClickResult extends ActionEffects {
46
152
  success: boolean;
47
153
  error?: string;
48
154
  selector?: string;
155
+ /** The element acted on, e.g. `input.toggle in div.view "Write report"` */
156
+ element?: string;
49
157
  elementType?: string;
50
158
  matchCount?: number;
51
159
  selectedIndex?: number;
@@ -61,14 +169,20 @@ export interface ClickResult {
61
169
  warning?: string;
62
170
  /** Dialogs accepted while the command ran */
63
171
  dialogs?: DialogInfo[];
172
+ /** Requests the action triggered (absent when network telemetry is off) */
173
+ triggeredRequests?: TriggeredRequest[];
174
+ /** Requests left out of `triggeredRequests` (it lists the first 50) */
175
+ triggeredRequestsOmitted?: number;
64
176
  }
65
177
  /**
66
178
  * Result of pressing a key on an element.
67
179
  */
68
- export interface PressKeyResult {
180
+ export interface PressKeyResult extends ActionEffects {
69
181
  success: boolean;
70
182
  error?: string;
71
183
  selector?: string;
184
+ /** The element acted on, e.g. `input.toggle in div.view "Write report"` */
185
+ element?: string;
72
186
  key?: string;
73
187
  times?: number;
74
188
  /** Modifier keys held, e.g. ["Ctrl", "Shift"] */
@@ -82,17 +196,23 @@ export interface PressKeyResult {
82
196
  warning?: string;
83
197
  /** Dialogs accepted while the command ran */
84
198
  dialogs?: DialogInfo[];
199
+ /** Requests the action triggered (absent when network telemetry is off) */
200
+ triggeredRequests?: TriggeredRequest[];
201
+ /** Requests left out of `triggeredRequests` (it lists the first 50) */
202
+ triggeredRequestsOmitted?: number;
85
203
  }
86
204
  /**
87
205
  * Result of a scroll operation.
88
206
  */
89
- export interface ScrollResult {
207
+ export interface ScrollResult extends ActionEffects {
90
208
  success: boolean;
91
209
  error?: string;
92
210
  suggestion?: string;
93
211
  exitCode?: number;
94
212
  scrollType: 'element' | 'position' | 'offset';
95
213
  selector?: string;
214
+ /** The element acted on, e.g. `input.toggle in div.view "Write report"` */
215
+ element?: string;
96
216
  scrolledTo?: {
97
217
  x: number;
98
218
  y: number;
@@ -113,22 +233,36 @@ export interface ScrollResult {
113
233
  matchCount?: number;
114
234
  /** Set when the selector matched several elements */
115
235
  warning?: string;
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;
116
240
  }
117
241
  /**
118
242
  * Result of submitting a form.
119
243
  */
120
- export interface SubmitResult {
244
+ export interface SubmitResult extends ActionEffects {
121
245
  success: boolean;
122
246
  error?: string;
123
247
  selector?: string;
248
+ /** The element acted on, e.g. `input.toggle in div.view "Write report"` */
249
+ element?: string;
124
250
  clicked?: boolean;
251
+ /** Set when the target is neither a form nor a button: a list from another command was likely meant */
252
+ unsuitableElement?: boolean;
125
253
  networkRequests?: number;
126
254
  navigationOccurred?: boolean;
127
255
  waitTimeMs?: number;
256
+ /** Set when the page loaded but its requests had not finished by the timeout */
257
+ warning?: string;
128
258
  suggestion?: string;
129
259
  exitCode?: number;
130
260
  /** Dialogs accepted while the command ran */
131
261
  dialogs?: DialogInfo[];
262
+ /** Requests the action triggered (absent when network telemetry is off) */
263
+ triggeredRequests?: TriggeredRequest[];
264
+ /** Requests left out of `triggeredRequests` (it lists the first 50) */
265
+ triggeredRequestsOmitted?: number;
132
266
  }
133
267
  /** Where an event listener is attached, seen from the inspected element. */
134
268
  export type ListenerPlacement = 'target' | 'ancestor' | 'document' | 'window';
@@ -157,6 +291,41 @@ export interface ElementListener {
157
291
  passive: boolean;
158
292
  once: boolean;
159
293
  handler: ListenerHandler;
294
+ /** The handler does nothing (an empty function, like React's `onclick` placeholder) */
295
+ noop?: true;
296
+ /**
297
+ * Registered through this framework; `handler` is the real handler, not
298
+ * the framework's dispatcher. React handlers are `on…` props of the node
299
+ * (`reactProp`), run by React's dispatchers on its root container;
300
+ * Preact handlers are run by Preact's event proxy on the node itself.
301
+ */
302
+ framework?: 'jQuery' | 'Preact' | 'React';
303
+ /** React prop the handler is set as, e.g. `onClick`, `onClickCapture` */
304
+ reactProp?: string;
305
+ /** jQuery delegate selector (`.on(type, selector, fn)`) the element matched */
306
+ delegateSelector?: string;
307
+ }
308
+ /**
309
+ * Listeners of one node collapsed into a summary: a framework root (React's
310
+ * root container) registers the same few dispatchers for dozens of event types.
311
+ */
312
+ export interface CollapsedListeners {
313
+ /** Where the listeners are attached */
314
+ on: ListenerPlacement;
315
+ /** The node or object they are attached to, e.g. `div#__next` */
316
+ node: string;
317
+ /** Framework recognised on the node, e.g. `React root` */
318
+ framework?: string;
319
+ /** Event types, alphabetically */
320
+ types: string[];
321
+ /** Number of listeners collapsed */
322
+ count: number;
323
+ /** Some listen in the capture phase */
324
+ capture: boolean;
325
+ /** Some listen in the bubble phase */
326
+ bubble: boolean;
327
+ /** The distinct dispatcher functions */
328
+ handlers: ListenerHandler[];
160
329
  }
161
330
  /**
162
331
  * Event listeners of an element, its ancestors, its document and window,
@@ -172,11 +341,112 @@ export interface ListenersResult {
172
341
  /** The inspected element, e.g. `button#save` */
173
342
  element: string;
174
343
  listeners: ElementListener[];
344
+ /** Framework root listeners, one entry per node (missing with `all`) */
345
+ collapsed?: CollapsedListeners[];
346
+ /** The iframe element whose document holds the element, e.g. `iframe#checkout` */
347
+ frame?: string;
348
+ /** jQuery handlers not resolved (over 50 per call): their dispatcher is listed instead */
349
+ jqueryHandlersSkipped?: number;
350
+ /** React `on…` props not resolved (over 50 per call) */
351
+ reactHandlersSkipped?: number;
352
+ /** Event types with listeners close to the requested ones, when none matched (`Click` → `click`) */
353
+ typeSuggestions?: string[];
175
354
  /** Elements the selector matched */
176
355
  matchCount?: number;
177
356
  /** Set when several elements matched and no --index was given */
178
357
  warning?: string;
179
358
  }
359
+ /** A point in CSS pixels. */
360
+ export interface LayoutPoint {
361
+ x: number;
362
+ y: number;
363
+ }
364
+ /** A width and height in CSS pixels. */
365
+ export interface LayoutSize {
366
+ width: number;
367
+ height: number;
368
+ }
369
+ /** Position and size of an element's border box in CSS pixels. */
370
+ export type LayoutBox = LayoutPoint & LayoutSize;
371
+ /** Computed styles that decide whether and how an element shows. */
372
+ export interface LayoutComputedStyle {
373
+ display: string;
374
+ visibility: string;
375
+ position: string;
376
+ opacity: string;
377
+ zIndex: string;
378
+ }
379
+ /** Where one element is on the page and whether a user can see it. */
380
+ export interface ElementLayout {
381
+ /** Index among the selector's matches (or in the cached query) */
382
+ index: number;
383
+ tag: string;
384
+ /** Short description, e.g. `button#save.primary` */
385
+ element: string;
386
+ /** Text preview */
387
+ text?: string;
388
+ /** Enclosing iframe(s) and shadow root, e.g. `iframe#pay > shadow root of <x-card>` */
389
+ context?: string;
390
+ /** Border box relative to the top-level document (page coordinates) */
391
+ bounds: LayoutBox;
392
+ /** Top-left corner relative to the top-level viewport */
393
+ viewport: LayoutPoint;
394
+ inViewport: ViewportPosition;
395
+ /** Share of the element in view, for `partly` */
396
+ percentVisible?: number;
397
+ /** Why it is `hidden`, e.g. `display: none` */
398
+ hiddenReason?: string;
399
+ /**
400
+ * Page scroll (`window.scrollBy`) that shows all of it, when the page can
401
+ * scroll there: for a `partly` visible element the smallest such scroll (the
402
+ * part cut off at the edge; the start of one larger than the viewport), for
403
+ * one out of view the scroll centring it (as `dom scroll <selector>` does)
404
+ */
405
+ scrollBy?: LayoutPoint;
406
+ /** Ancestor or iframe cutting it off (scroll that container instead of the page) */
407
+ clippedBy?: string;
408
+ /** Why page scroll cannot bring it fully into view: it is fixed, or beyond the page's scroll range */
409
+ offScreenReason?: string;
410
+ /** Topmost element at the center of its visible part, when that is another element */
411
+ coveredBy?: string;
412
+ /**
413
+ * The covering element paints nothing at that point (no background, image,
414
+ * shadow or text of its own): the element still shows, but clicks land on
415
+ * the cover
416
+ */
417
+ coverTransparent?: true;
418
+ /**
419
+ * Why it cannot be seen although it is rendered: `opacity: 0` on it or an
420
+ * ancestor, or a `clip-path`/`clip` that cuts it away entirely, e.g.
421
+ * `opacity: 0 on div#menu` (`inViewport` still says where it is)
422
+ */
423
+ invisible?: string;
424
+ /** Inside an `inert` element: shown, but a user cannot interact with it */
425
+ inert?: true;
426
+ computed: LayoutComputedStyle;
427
+ }
428
+ /** Viewport, scroll position and document size of the top-level page. */
429
+ export interface PageLayout {
430
+ /** Layout viewport without scrollbars (as `dom scroll` reports it) */
431
+ viewport: LayoutSize;
432
+ scroll: LayoutPoint;
433
+ document: LayoutSize;
434
+ /** `prefers-color-scheme` the page sees (the system's unless `--color-scheme` was given at start) */
435
+ colorScheme?: 'light' | 'dark';
436
+ }
437
+ /** Layout of the elements a selector (or cached index) refers to. */
438
+ export interface LayoutResult {
439
+ /** Always true: failures are reported as errors */
440
+ success: true;
441
+ /** Selector the elements were found with (for an index: the cached query's) */
442
+ selector: string;
443
+ /** Elements the selector matched (1 for an index) */
444
+ count: number;
445
+ page: PageLayout;
446
+ elements: ElementLayout[];
447
+ /** Matches left out of `elements` (beyond the limit) */
448
+ omitted?: number;
449
+ }
180
450
  /**
181
451
  * Raw form data returned from the page-context form-discovery script.
182
452
  */
@@ -186,6 +456,8 @@ export interface RawFormData {
186
456
  frameForms?: Array<{
187
457
  url: string;
188
458
  }>;
459
+ /** The page's `document.readyState` when the forms were read */
460
+ readyState?: string;
189
461
  }
190
462
  export interface RawForm {
191
463
  index: number;
@@ -194,6 +466,10 @@ export interface RawForm {
194
466
  method: string;
195
467
  step: FormStep | null;
196
468
  relevanceScore: number;
469
+ /** Not rendered (or visibility-hidden), or all its fields are */
470
+ hidden?: boolean;
471
+ /** Shown inside an open dialog (`dialog[open]`, `aria-modal`, a dialog role) */
472
+ inDialog?: boolean;
197
473
  inIframe: boolean;
198
474
  iframeUrl?: string;
199
475
  crossOrigin?: boolean;
@@ -209,7 +485,10 @@ export interface RawField {
209
485
  label: string;
210
486
  name: string | null;
211
487
  placeholder?: string;
488
+ /** `required`, aria-required, or a label marked with an asterisk */
212
489
  required: boolean;
490
+ /** Name of the radio/checkbox group (legend, radiogroup label or name) */
491
+ groupLabel?: string;
213
492
  disabled: boolean;
214
493
  readOnly: boolean;
215
494
  hidden: boolean;
@@ -231,6 +510,11 @@ export interface RawButton {
231
510
  label: string;
232
511
  type: string;
233
512
  disabled: boolean;
234
- isPrimary: boolean;
513
+ /** A submit button by markup: `<input type=submit>` or `type="submit"` written out */
514
+ explicitSubmit: boolean;
515
+ /** A `<button>` without a type in a form: submits it, like Enter does */
516
+ formDefault: boolean;
517
+ /** Has a class like `primary`, `btn-primary` or `submit` */
518
+ primaryClass: boolean;
235
519
  }
236
520
  //# sourceMappingURL=domTypes.d.ts.map