vendor/github.com/go-rod/rod/lib/proto/dom_snapshot.go
458 lines · 19808 bytes
1// This file is generated by "./lib/proto/generate"
2
3package proto
4
5/*
6
7DOMSnapshot
8
9This domain facilitates obtaining document snapshots with DOM, layout, and style information.
10
11*/
12
13// DOMSnapshotDOMNode A Node in the DOM tree.
14type DOMSnapshotDOMNode struct {
15 // NodeType `Node`'s nodeType.
16 NodeType int `json:"nodeType"`
17
18 // NodeName `Node`'s nodeName.
19 NodeName string `json:"nodeName"`
20
21 // NodeValue `Node`'s nodeValue.
22 NodeValue string `json:"nodeValue"`
23
24 // TextValue (optional) Only set for textarea elements, contains the text value.
25 TextValue string `json:"textValue,omitempty"`
26
27 // InputValue (optional) Only set for input elements, contains the input's associated text value.
28 InputValue string `json:"inputValue,omitempty"`
29
30 // InputChecked (optional) Only set for radio and checkbox input elements, indicates if the element has been checked
31 InputChecked bool `json:"inputChecked,omitempty"`
32
33 // OptionSelected (optional) Only set for option elements, indicates if the element has been selected
34 OptionSelected bool `json:"optionSelected,omitempty"`
35
36 // BackendNodeID `Node`'s id, corresponds to DOM.Node.backendNodeId.
37 BackendNodeID DOMBackendNodeID `json:"backendNodeId"`
38
39 // ChildNodeIndexes (optional) The indexes of the node's child nodes in the `domNodes` array returned by `getSnapshot`, if
40 // any.
41 ChildNodeIndexes []int `json:"childNodeIndexes,omitempty"`
42
43 // Attributes (optional) Attributes of an `Element` node.
44 Attributes []*DOMSnapshotNameValue `json:"attributes,omitempty"`
45
46 // PseudoElementIndexes (optional) Indexes of pseudo elements associated with this node in the `domNodes` array returned by
47 // `getSnapshot`, if any.
48 PseudoElementIndexes []int `json:"pseudoElementIndexes,omitempty"`
49
50 // LayoutNodeIndex (optional) The index of the node's related layout tree node in the `layoutTreeNodes` array returned by
51 // `getSnapshot`, if any.
52 LayoutNodeIndex *int `json:"layoutNodeIndex,omitempty"`
53
54 // DocumentURL (optional) Document URL that `Document` or `FrameOwner` node points to.
55 DocumentURL string `json:"documentURL,omitempty"`
56
57 // BaseURL (optional) Base URL that `Document` or `FrameOwner` node uses for URL completion.
58 BaseURL string `json:"baseURL,omitempty"`
59
60 // ContentLanguage (optional) Only set for documents, contains the document's content language.
61 ContentLanguage string `json:"contentLanguage,omitempty"`
62
63 // DocumentEncoding (optional) Only set for documents, contains the document's character set encoding.
64 DocumentEncoding string `json:"documentEncoding,omitempty"`
65
66 // PublicID (optional) `DocumentType` node's publicId.
67 PublicID string `json:"publicId,omitempty"`
68
69 // SystemID (optional) `DocumentType` node's systemId.
70 SystemID string `json:"systemId,omitempty"`
71
72 // FrameID (optional) Frame ID for frame owner elements and also for the document node.
73 FrameID PageFrameID `json:"frameId,omitempty"`
74
75 // ContentDocumentIndex (optional) The index of a frame owner element's content document in the `domNodes` array returned by
76 // `getSnapshot`, if any.
77 ContentDocumentIndex *int `json:"contentDocumentIndex,omitempty"`
78
79 // PseudoType (optional) Type of a pseudo element node.
80 PseudoType DOMPseudoType `json:"pseudoType,omitempty"`
81
82 // ShadowRootType (optional) Shadow root type.
83 ShadowRootType DOMShadowRootType `json:"shadowRootType,omitempty"`
84
85 // IsClickable (optional) Whether this DOM node responds to mouse clicks. This includes nodes that have had click
86 // event listeners attached via JavaScript as well as anchor tags that naturally navigate when
87 // clicked.
88 IsClickable bool `json:"isClickable,omitempty"`
89
90 // EventListeners (optional) Details of the node's event listeners, if any.
91 EventListeners []*DOMDebuggerEventListener `json:"eventListeners,omitempty"`
92
93 // CurrentSourceURL (optional) The selected url for nodes with a srcset attribute.
94 CurrentSourceURL string `json:"currentSourceURL,omitempty"`
95
96 // OriginURL (optional) The url of the script (if any) that generates this node.
97 OriginURL string `json:"originURL,omitempty"`
98
99 // ScrollOffsetX (optional) Scroll offsets, set when this node is a Document.
100 ScrollOffsetX *float64 `json:"scrollOffsetX,omitempty"`
101
102 // ScrollOffsetY (optional) ...
103 ScrollOffsetY *float64 `json:"scrollOffsetY,omitempty"`
104}
105
106// DOMSnapshotInlineTextBox Details of post layout rendered text positions. The exact layout should not be regarded as
107// stable and may change between versions.
108type DOMSnapshotInlineTextBox struct {
109 // BoundingBox The bounding box in document coordinates. Note that scroll offset of the document is ignored.
110 BoundingBox *DOMRect `json:"boundingBox"`
111
112 // StartCharacterIndex The starting index in characters, for this post layout textbox substring. Characters that
113 // would be represented as a surrogate pair in UTF-16 have length 2.
114 StartCharacterIndex int `json:"startCharacterIndex"`
115
116 // NumCharacters The number of characters in this post layout textbox substring. Characters that would be
117 // represented as a surrogate pair in UTF-16 have length 2.
118 NumCharacters int `json:"numCharacters"`
119}
120
121// DOMSnapshotLayoutTreeNode Details of an element in the DOM tree with a LayoutObject.
122type DOMSnapshotLayoutTreeNode struct {
123 // DomNodeIndex The index of the related DOM node in the `domNodes` array returned by `getSnapshot`.
124 DomNodeIndex int `json:"domNodeIndex"`
125
126 // BoundingBox The bounding box in document coordinates. Note that scroll offset of the document is ignored.
127 BoundingBox *DOMRect `json:"boundingBox"`
128
129 // LayoutText (optional) Contents of the LayoutText, if any.
130 LayoutText string `json:"layoutText,omitempty"`
131
132 // InlineTextNodes (optional) The post-layout inline text nodes, if any.
133 InlineTextNodes []*DOMSnapshotInlineTextBox `json:"inlineTextNodes,omitempty"`
134
135 // StyleIndex (optional) Index into the `computedStyles` array returned by `getSnapshot`.
136 StyleIndex *int `json:"styleIndex,omitempty"`
137
138 // PaintOrder (optional) Global paint order index, which is determined by the stacking order of the nodes. Nodes
139 // that are painted together will have the same index. Only provided if includePaintOrder in
140 // getSnapshot was true.
141 PaintOrder *int `json:"paintOrder,omitempty"`
142
143 // IsStackingContext (optional) Set to true to indicate the element begins a new stacking context.
144 IsStackingContext bool `json:"isStackingContext,omitempty"`
145}
146
147// DOMSnapshotComputedStyle A subset of the full ComputedStyle as defined by the request whitelist.
148type DOMSnapshotComputedStyle struct {
149 // Properties Name/value pairs of computed style properties.
150 Properties []*DOMSnapshotNameValue `json:"properties"`
151}
152
153// DOMSnapshotNameValue A name/value pair.
154type DOMSnapshotNameValue struct {
155 // Name Attribute/property name.
156 Name string `json:"name"`
157
158 // Value Attribute/property value.
159 Value string `json:"value"`
160}
161
162// DOMSnapshotStringIndex Index of the string in the strings table.
163type DOMSnapshotStringIndex int
164
165// DOMSnapshotArrayOfStrings Index of the string in the strings table.
166type DOMSnapshotArrayOfStrings []DOMSnapshotStringIndex
167
168// DOMSnapshotRareStringData Data that is only present on rare nodes.
169type DOMSnapshotRareStringData struct {
170 // Index ...
171 Index []int `json:"index"`
172
173 // Value ...
174 Value []DOMSnapshotStringIndex `json:"value"`
175}
176
177// DOMSnapshotRareBooleanData ...
178type DOMSnapshotRareBooleanData struct {
179 // Index ...
180 Index []int `json:"index"`
181}
182
183// DOMSnapshotRareIntegerData ...
184type DOMSnapshotRareIntegerData struct {
185 // Index ...
186 Index []int `json:"index"`
187
188 // Value ...
189 Value []int `json:"value"`
190}
191
192// DOMSnapshotRectangle ...
193type DOMSnapshotRectangle []float64
194
195// DOMSnapshotDocumentSnapshot Document snapshot.
196type DOMSnapshotDocumentSnapshot struct {
197 // DocumentURL Document URL that `Document` or `FrameOwner` node points to.
198 DocumentURL DOMSnapshotStringIndex `json:"documentURL"`
199
200 // Title Document title.
201 Title DOMSnapshotStringIndex `json:"title"`
202
203 // BaseURL Base URL that `Document` or `FrameOwner` node uses for URL completion.
204 BaseURL DOMSnapshotStringIndex `json:"baseURL"`
205
206 // ContentLanguage Contains the document's content language.
207 ContentLanguage DOMSnapshotStringIndex `json:"contentLanguage"`
208
209 // EncodingName Contains the document's character set encoding.
210 EncodingName DOMSnapshotStringIndex `json:"encodingName"`
211
212 // PublicID `DocumentType` node's publicId.
213 PublicID DOMSnapshotStringIndex `json:"publicId"`
214
215 // SystemID `DocumentType` node's systemId.
216 SystemID DOMSnapshotStringIndex `json:"systemId"`
217
218 // FrameID Frame ID for frame owner elements and also for the document node.
219 FrameID DOMSnapshotStringIndex `json:"frameId"`
220
221 // Nodes A table with dom nodes.
222 Nodes *DOMSnapshotNodeTreeSnapshot `json:"nodes"`
223
224 // Layout The nodes in the layout tree.
225 Layout *DOMSnapshotLayoutTreeSnapshot `json:"layout"`
226
227 // TextBoxes The post-layout inline text nodes.
228 TextBoxes *DOMSnapshotTextBoxSnapshot `json:"textBoxes"`
229
230 // ScrollOffsetX (optional) Horizontal scroll offset.
231 ScrollOffsetX *float64 `json:"scrollOffsetX,omitempty"`
232
233 // ScrollOffsetY (optional) Vertical scroll offset.
234 ScrollOffsetY *float64 `json:"scrollOffsetY,omitempty"`
235
236 // ContentWidth (optional) Document content width.
237 ContentWidth *float64 `json:"contentWidth,omitempty"`
238
239 // ContentHeight (optional) Document content height.
240 ContentHeight *float64 `json:"contentHeight,omitempty"`
241}
242
243// DOMSnapshotNodeTreeSnapshot Table containing nodes.
244type DOMSnapshotNodeTreeSnapshot struct {
245 // ParentIndex (optional) Parent node index.
246 ParentIndex []int `json:"parentIndex,omitempty"`
247
248 // NodeType (optional) `Node`'s nodeType.
249 NodeType []int `json:"nodeType,omitempty"`
250
251 // ShadowRootType (optional) Type of the shadow root the `Node` is in. String values are equal to the `ShadowRootType` enum.
252 ShadowRootType *DOMSnapshotRareStringData `json:"shadowRootType,omitempty"`
253
254 // NodeName (optional) `Node`'s nodeName.
255 NodeName []DOMSnapshotStringIndex `json:"nodeName,omitempty"`
256
257 // NodeValue (optional) `Node`'s nodeValue.
258 NodeValue []DOMSnapshotStringIndex `json:"nodeValue,omitempty"`
259
260 // BackendNodeID (optional) `Node`'s id, corresponds to DOM.Node.backendNodeId.
261 BackendNodeID []DOMBackendNodeID `json:"backendNodeId,omitempty"`
262
263 // Attributes (optional) Attributes of an `Element` node. Flatten name, value pairs.
264 Attributes []DOMSnapshotArrayOfStrings `json:"attributes,omitempty"`
265
266 // TextValue (optional) Only set for textarea elements, contains the text value.
267 TextValue *DOMSnapshotRareStringData `json:"textValue,omitempty"`
268
269 // InputValue (optional) Only set for input elements, contains the input's associated text value.
270 InputValue *DOMSnapshotRareStringData `json:"inputValue,omitempty"`
271
272 // InputChecked (optional) Only set for radio and checkbox input elements, indicates if the element has been checked
273 InputChecked *DOMSnapshotRareBooleanData `json:"inputChecked,omitempty"`
274
275 // OptionSelected (optional) Only set for option elements, indicates if the element has been selected
276 OptionSelected *DOMSnapshotRareBooleanData `json:"optionSelected,omitempty"`
277
278 // ContentDocumentIndex (optional) The index of the document in the list of the snapshot documents.
279 ContentDocumentIndex *DOMSnapshotRareIntegerData `json:"contentDocumentIndex,omitempty"`
280
281 // PseudoType (optional) Type of a pseudo element node.
282 PseudoType *DOMSnapshotRareStringData `json:"pseudoType,omitempty"`
283
284 // PseudoIdentifier (optional) Pseudo element identifier for this node. Only present if there is a
285 // valid pseudoType.
286 PseudoIdentifier *DOMSnapshotRareStringData `json:"pseudoIdentifier,omitempty"`
287
288 // IsClickable (optional) Whether this DOM node responds to mouse clicks. This includes nodes that have had click
289 // event listeners attached via JavaScript as well as anchor tags that naturally navigate when
290 // clicked.
291 IsClickable *DOMSnapshotRareBooleanData `json:"isClickable,omitempty"`
292
293 // CurrentSourceURL (optional) The selected url for nodes with a srcset attribute.
294 CurrentSourceURL *DOMSnapshotRareStringData `json:"currentSourceURL,omitempty"`
295
296 // OriginURL (optional) The url of the script (if any) that generates this node.
297 OriginURL *DOMSnapshotRareStringData `json:"originURL,omitempty"`
298}
299
300// DOMSnapshotLayoutTreeSnapshot Table of details of an element in the DOM tree with a LayoutObject.
301type DOMSnapshotLayoutTreeSnapshot struct {
302 // NodeIndex Index of the corresponding node in the `NodeTreeSnapshot` array returned by `captureSnapshot`.
303 NodeIndex []int `json:"nodeIndex"`
304
305 // Styles Array of indexes specifying computed style strings, filtered according to the `computedStyles` parameter passed to `captureSnapshot`.
306 Styles []DOMSnapshotArrayOfStrings `json:"styles"`
307
308 // Bounds The absolute position bounding box.
309 Bounds []DOMSnapshotRectangle `json:"bounds"`
310
311 // Text Contents of the LayoutText, if any.
312 Text []DOMSnapshotStringIndex `json:"text"`
313
314 // StackingContexts Stacking context information.
315 StackingContexts *DOMSnapshotRareBooleanData `json:"stackingContexts"`
316
317 // PaintOrders (optional) Global paint order index, which is determined by the stacking order of the nodes. Nodes
318 // that are painted together will have the same index. Only provided if includePaintOrder in
319 // captureSnapshot was true.
320 PaintOrders []int `json:"paintOrders,omitempty"`
321
322 // OffsetRects (optional) The offset rect of nodes. Only available when includeDOMRects is set to true
323 OffsetRects []DOMSnapshotRectangle `json:"offsetRects,omitempty"`
324
325 // ScrollRects (optional) The scroll rect of nodes. Only available when includeDOMRects is set to true
326 ScrollRects []DOMSnapshotRectangle `json:"scrollRects,omitempty"`
327
328 // ClientRects (optional) The client rect of nodes. Only available when includeDOMRects is set to true
329 ClientRects []DOMSnapshotRectangle `json:"clientRects,omitempty"`
330
331 // BlendedBackgroundColors (experimental) (optional) The list of background colors that are blended with colors of overlapping elements.
332 BlendedBackgroundColors []DOMSnapshotStringIndex `json:"blendedBackgroundColors,omitempty"`
333
334 // TextColorOpacities (experimental) (optional) The list of computed text opacities.
335 TextColorOpacities []float64 `json:"textColorOpacities,omitempty"`
336}
337
338// DOMSnapshotTextBoxSnapshot Table of details of the post layout rendered text positions. The exact layout should not be regarded as
339// stable and may change between versions.
340type DOMSnapshotTextBoxSnapshot struct {
341 // LayoutIndex Index of the layout tree node that owns this box collection.
342 LayoutIndex []int `json:"layoutIndex"`
343
344 // Bounds The absolute position bounding box.
345 Bounds []DOMSnapshotRectangle `json:"bounds"`
346
347 // Start The starting index in characters, for this post layout textbox substring. Characters that
348 // would be represented as a surrogate pair in UTF-16 have length 2.
349 Start []int `json:"start"`
350
351 // Length The number of characters in this post layout textbox substring. Characters that would be
352 // represented as a surrogate pair in UTF-16 have length 2.
353 Length []int `json:"length"`
354}
355
356// DOMSnapshotDisable Disables DOM snapshot agent for the given page.
357type DOMSnapshotDisable struct{}
358
359// ProtoReq name.
360func (m DOMSnapshotDisable) ProtoReq() string { return "DOMSnapshot.disable" }
361
362// Call sends the request.
363func (m DOMSnapshotDisable) Call(c Client) error {
364 return call(m.ProtoReq(), m, nil, c)
365}
366
367// DOMSnapshotEnable Enables DOM snapshot agent for the given page.
368type DOMSnapshotEnable struct{}
369
370// ProtoReq name.
371func (m DOMSnapshotEnable) ProtoReq() string { return "DOMSnapshot.enable" }
372
373// Call sends the request.
374func (m DOMSnapshotEnable) Call(c Client) error {
375 return call(m.ProtoReq(), m, nil, c)
376}
377
378// DOMSnapshotGetSnapshot (deprecated) Returns a document snapshot, including the full DOM tree of the root node (including iframes,
379// template contents, and imported documents) in a flattened array, as well as layout and
380// white-listed computed style information for the nodes. Shadow DOM in the returned DOM tree is
381// flattened.
382type DOMSnapshotGetSnapshot struct {
383 // ComputedStyleWhitelist Whitelist of computed styles to return.
384 ComputedStyleWhitelist []string `json:"computedStyleWhitelist"`
385
386 // IncludeEventListeners (optional) Whether or not to retrieve details of DOM listeners (default false).
387 IncludeEventListeners bool `json:"includeEventListeners,omitempty"`
388
389 // IncludePaintOrder (optional) Whether to determine and include the paint order index of LayoutTreeNodes (default false).
390 IncludePaintOrder bool `json:"includePaintOrder,omitempty"`
391
392 // IncludeUserAgentShadowTree (optional) Whether to include UA shadow tree in the snapshot (default false).
393 IncludeUserAgentShadowTree bool `json:"includeUserAgentShadowTree,omitempty"`
394}
395
396// ProtoReq name.
397func (m DOMSnapshotGetSnapshot) ProtoReq() string { return "DOMSnapshot.getSnapshot" }
398
399// Call the request.
400func (m DOMSnapshotGetSnapshot) Call(c Client) (*DOMSnapshotGetSnapshotResult, error) {
401 var res DOMSnapshotGetSnapshotResult
402 return &res, call(m.ProtoReq(), m, &res, c)
403}
404
405// DOMSnapshotGetSnapshotResult (deprecated) ...
406type DOMSnapshotGetSnapshotResult struct {
407 // DomNodes The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document.
408 DomNodes []*DOMSnapshotDOMNode `json:"domNodes"`
409
410 // LayoutTreeNodes The nodes in the layout tree.
411 LayoutTreeNodes []*DOMSnapshotLayoutTreeNode `json:"layoutTreeNodes"`
412
413 // ComputedStyles Whitelisted ComputedStyle properties for each node in the layout tree.
414 ComputedStyles []*DOMSnapshotComputedStyle `json:"computedStyles"`
415}
416
417// DOMSnapshotCaptureSnapshot Returns a document snapshot, including the full DOM tree of the root node (including iframes,
418// template contents, and imported documents) in a flattened array, as well as layout and
419// white-listed computed style information for the nodes. Shadow DOM in the returned DOM tree is
420// flattened.
421type DOMSnapshotCaptureSnapshot struct {
422 // ComputedStyles Whitelist of computed styles to return.
423 ComputedStyles []string `json:"computedStyles"`
424
425 // IncludePaintOrder (optional) Whether to include layout object paint orders into the snapshot.
426 IncludePaintOrder bool `json:"includePaintOrder,omitempty"`
427
428 // IncludeDOMRects (optional) Whether to include DOM rectangles (offsetRects, clientRects, scrollRects) into the snapshot
429 IncludeDOMRects bool `json:"includeDOMRects,omitempty"`
430
431 // IncludeBlendedBackgroundColors (experimental) (optional) Whether to include blended background colors in the snapshot (default: false).
432 // Blended background color is achieved by blending background colors of all elements
433 // that overlap with the current element.
434 IncludeBlendedBackgroundColors bool `json:"includeBlendedBackgroundColors,omitempty"`
435
436 // IncludeTextColorOpacities (experimental) (optional) Whether to include text color opacity in the snapshot (default: false).
437 // An element might have the opacity property set that affects the text color of the element.
438 // The final text color opacity is computed based on the opacity of all overlapping elements.
439 IncludeTextColorOpacities bool `json:"includeTextColorOpacities,omitempty"`
440}
441
442// ProtoReq name.
443func (m DOMSnapshotCaptureSnapshot) ProtoReq() string { return "DOMSnapshot.captureSnapshot" }
444
445// Call the request.
446func (m DOMSnapshotCaptureSnapshot) Call(c Client) (*DOMSnapshotCaptureSnapshotResult, error) {
447 var res DOMSnapshotCaptureSnapshotResult
448 return &res, call(m.ProtoReq(), m, &res, c)
449}
450
451// DOMSnapshotCaptureSnapshotResult ...
452type DOMSnapshotCaptureSnapshotResult struct {
453 // Documents The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document.
454 Documents []*DOMSnapshotDocumentSnapshot `json:"documents"`
455
456 // Strings Shared string table that all string properties refer to with indexes.
457 Strings []string `json:"strings"`
458}