-
-
Notifications
You must be signed in to change notification settings - Fork 324
/
dom.go
1681 lines (1288 loc) · 52.9 KB
/
dom.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// This file is generated by "./lib/proto/generate"
package proto
import (
"github.com/ysmood/gson"
)
/*
DOM
This domain exposes DOM read/write operations. Each DOM Node is represented with its mirror object
that has an `id`. This `id` can be used to get additional information on the Node, resolve it into
the JavaScript object wrapper, etc. It is important that client receives DOM events only for the
nodes that are known to the client. Backend keeps track of the nodes that were sent to the client
and never sends the same node twice. It is client's responsibility to collect information about
the nodes that were sent to the client. Note that `iframe` owner elements will return
corresponding document elements as their child nodes.
*/
// DOMNodeID Unique DOM node identifier.
type DOMNodeID int
// DOMBackendNodeID Unique DOM node identifier used to reference a node that may not have been pushed to the
// front-end.
type DOMBackendNodeID int
// DOMBackendNode Backend node with a friendly name.
type DOMBackendNode struct {
// NodeType `Node`'s nodeType.
NodeType int `json:"nodeType"`
// NodeName `Node`'s nodeName.
NodeName string `json:"nodeName"`
// BackendNodeID ...
BackendNodeID DOMBackendNodeID `json:"backendNodeId"`
}
// DOMPseudoType Pseudo element type.
type DOMPseudoType string
const (
// DOMPseudoTypeFirstLine enum const.
DOMPseudoTypeFirstLine DOMPseudoType = "first-line"
// DOMPseudoTypeFirstLetter enum const.
DOMPseudoTypeFirstLetter DOMPseudoType = "first-letter"
// DOMPseudoTypeBefore enum const.
DOMPseudoTypeBefore DOMPseudoType = "before"
// DOMPseudoTypeAfter enum const.
DOMPseudoTypeAfter DOMPseudoType = "after"
// DOMPseudoTypeMarker enum const.
DOMPseudoTypeMarker DOMPseudoType = "marker"
// DOMPseudoTypeBackdrop enum const.
DOMPseudoTypeBackdrop DOMPseudoType = "backdrop"
// DOMPseudoTypeSelection enum const.
DOMPseudoTypeSelection DOMPseudoType = "selection"
// DOMPseudoTypeTargetText enum const.
DOMPseudoTypeTargetText DOMPseudoType = "target-text"
// DOMPseudoTypeSpellingError enum const.
DOMPseudoTypeSpellingError DOMPseudoType = "spelling-error"
// DOMPseudoTypeGrammarError enum const.
DOMPseudoTypeGrammarError DOMPseudoType = "grammar-error"
// DOMPseudoTypeHighlight enum const.
DOMPseudoTypeHighlight DOMPseudoType = "highlight"
// DOMPseudoTypeFirstLineInherited enum const.
DOMPseudoTypeFirstLineInherited DOMPseudoType = "first-line-inherited"
// DOMPseudoTypeScrollMarker enum const.
DOMPseudoTypeScrollMarker DOMPseudoType = "scroll-marker"
// DOMPseudoTypeScrollMarkers enum const.
DOMPseudoTypeScrollMarkers DOMPseudoType = "scroll-markers"
// DOMPseudoTypeScrollbar enum const.
DOMPseudoTypeScrollbar DOMPseudoType = "scrollbar"
// DOMPseudoTypeScrollbarThumb enum const.
DOMPseudoTypeScrollbarThumb DOMPseudoType = "scrollbar-thumb"
// DOMPseudoTypeScrollbarButton enum const.
DOMPseudoTypeScrollbarButton DOMPseudoType = "scrollbar-button"
// DOMPseudoTypeScrollbarTrack enum const.
DOMPseudoTypeScrollbarTrack DOMPseudoType = "scrollbar-track"
// DOMPseudoTypeScrollbarTrackPiece enum const.
DOMPseudoTypeScrollbarTrackPiece DOMPseudoType = "scrollbar-track-piece"
// DOMPseudoTypeScrollbarCorner enum const.
DOMPseudoTypeScrollbarCorner DOMPseudoType = "scrollbar-corner"
// DOMPseudoTypeResizer enum const.
DOMPseudoTypeResizer DOMPseudoType = "resizer"
// DOMPseudoTypeInputListButton enum const.
DOMPseudoTypeInputListButton DOMPseudoType = "input-list-button"
// DOMPseudoTypeViewTransition enum const.
DOMPseudoTypeViewTransition DOMPseudoType = "view-transition"
// DOMPseudoTypeViewTransitionGroup enum const.
DOMPseudoTypeViewTransitionGroup DOMPseudoType = "view-transition-group"
// DOMPseudoTypeViewTransitionImagePair enum const.
DOMPseudoTypeViewTransitionImagePair DOMPseudoType = "view-transition-image-pair"
// DOMPseudoTypeViewTransitionOld enum const.
DOMPseudoTypeViewTransitionOld DOMPseudoType = "view-transition-old"
// DOMPseudoTypeViewTransitionNew enum const.
DOMPseudoTypeViewTransitionNew DOMPseudoType = "view-transition-new"
)
// DOMShadowRootType Shadow root type.
type DOMShadowRootType string
const (
// DOMShadowRootTypeUserAgent enum const.
DOMShadowRootTypeUserAgent DOMShadowRootType = "user-agent"
// DOMShadowRootTypeOpen enum const.
DOMShadowRootTypeOpen DOMShadowRootType = "open"
// DOMShadowRootTypeClosed enum const.
DOMShadowRootTypeClosed DOMShadowRootType = "closed"
)
// DOMCompatibilityMode Document compatibility mode.
type DOMCompatibilityMode string
const (
// DOMCompatibilityModeQuirksMode enum const.
DOMCompatibilityModeQuirksMode DOMCompatibilityMode = "QuirksMode"
// DOMCompatibilityModeLimitedQuirksMode enum const.
DOMCompatibilityModeLimitedQuirksMode DOMCompatibilityMode = "LimitedQuirksMode"
// DOMCompatibilityModeNoQuirksMode enum const.
DOMCompatibilityModeNoQuirksMode DOMCompatibilityMode = "NoQuirksMode"
)
// DOMPhysicalAxes ContainerSelector physical axes.
type DOMPhysicalAxes string
const (
// DOMPhysicalAxesHorizontal enum const.
DOMPhysicalAxesHorizontal DOMPhysicalAxes = "Horizontal"
// DOMPhysicalAxesVertical enum const.
DOMPhysicalAxesVertical DOMPhysicalAxes = "Vertical"
// DOMPhysicalAxesBoth enum const.
DOMPhysicalAxesBoth DOMPhysicalAxes = "Both"
)
// DOMLogicalAxes ContainerSelector logical axes.
type DOMLogicalAxes string
const (
// DOMLogicalAxesInline enum const.
DOMLogicalAxesInline DOMLogicalAxes = "Inline"
// DOMLogicalAxesBlock enum const.
DOMLogicalAxesBlock DOMLogicalAxes = "Block"
// DOMLogicalAxesBoth enum const.
DOMLogicalAxesBoth DOMLogicalAxes = "Both"
)
// DOMScrollOrientation Physical scroll orientation.
type DOMScrollOrientation string
const (
// DOMScrollOrientationHorizontal enum const.
DOMScrollOrientationHorizontal DOMScrollOrientation = "horizontal"
// DOMScrollOrientationVertical enum const.
DOMScrollOrientationVertical DOMScrollOrientation = "vertical"
)
// DOMNode DOM interaction is implemented in terms of mirror objects that represent the actual DOM nodes.
// DOMNode is a base node mirror type.
type DOMNode struct {
// NodeID Node identifier that is passed into the rest of the DOM messages as the `nodeId`. Backend
// will only push node with given `id` once. It is aware of all requested nodes and will only
// fire DOM events for nodes known to the client.
NodeID DOMNodeID `json:"nodeId"`
// ParentID (optional) The id of the parent node if any.
ParentID DOMNodeID `json:"parentId,omitempty"`
// BackendNodeID The BackendNodeId for this node.
BackendNodeID DOMBackendNodeID `json:"backendNodeId"`
// NodeType `Node`'s nodeType.
NodeType int `json:"nodeType"`
// NodeName `Node`'s nodeName.
NodeName string `json:"nodeName"`
// LocalName `Node`'s localName.
LocalName string `json:"localName"`
// NodeValue `Node`'s nodeValue.
NodeValue string `json:"nodeValue"`
// ChildNodeCount (optional) Child count for `Container` nodes.
ChildNodeCount *int `json:"childNodeCount,omitempty"`
// Children (optional) Child nodes of this node when requested with children.
Children []*DOMNode `json:"children,omitempty"`
// Attributes (optional) Attributes of the `Element` node in the form of flat array `[name1, value1, name2, value2]`.
Attributes []string `json:"attributes,omitempty"`
// DocumentURL (optional) Document URL that `Document` or `FrameOwner` node points to.
DocumentURL string `json:"documentURL,omitempty"`
// BaseURL (optional) Base URL that `Document` or `FrameOwner` node uses for URL completion.
BaseURL string `json:"baseURL,omitempty"`
// PublicID (optional) `DocumentType`'s publicId.
PublicID string `json:"publicId,omitempty"`
// SystemID (optional) `DocumentType`'s systemId.
SystemID string `json:"systemId,omitempty"`
// InternalSubset (optional) `DocumentType`'s internalSubset.
InternalSubset string `json:"internalSubset,omitempty"`
// XMLVersion (optional) `Document`'s XML version in case of XML documents.
XMLVersion string `json:"xmlVersion,omitempty"`
// Name (optional) `Attr`'s name.
Name string `json:"name,omitempty"`
// Value (optional) `Attr`'s value.
Value string `json:"value,omitempty"`
// PseudoType (optional) Pseudo element type for this node.
PseudoType DOMPseudoType `json:"pseudoType,omitempty"`
// PseudoIdentifier (optional) Pseudo element identifier for this node. Only present if there is a
// valid pseudoType.
PseudoIdentifier string `json:"pseudoIdentifier,omitempty"`
// ShadowRootType (optional) Shadow root type.
ShadowRootType DOMShadowRootType `json:"shadowRootType,omitempty"`
// FrameID (optional) Frame ID for frame owner elements.
FrameID PageFrameID `json:"frameId,omitempty"`
// ContentDocument (optional) Content document for frame owner elements.
ContentDocument *DOMNode `json:"contentDocument,omitempty"`
// ShadowRoots (optional) Shadow root list for given element host.
ShadowRoots []*DOMNode `json:"shadowRoots,omitempty"`
// TemplateContent (optional) Content document fragment for template elements.
TemplateContent *DOMNode `json:"templateContent,omitempty"`
// PseudoElements (optional) Pseudo elements associated with this node.
PseudoElements []*DOMNode `json:"pseudoElements,omitempty"`
// ImportedDocument (deprecated) (optional) Deprecated, as the HTML Imports API has been removed (crbug.com/937746).
// This property used to return the imported document for the HTMLImport links.
// The property is always undefined now.
ImportedDocument *DOMNode `json:"importedDocument,omitempty"`
// DistributedNodes (optional) Distributed nodes for given insertion point.
DistributedNodes []*DOMBackendNode `json:"distributedNodes,omitempty"`
// IsSVG (optional) Whether the node is SVG.
IsSVG bool `json:"isSVG,omitempty"`
// CompatibilityMode (optional) ...
CompatibilityMode DOMCompatibilityMode `json:"compatibilityMode,omitempty"`
// AssignedSlot (optional) ...
AssignedSlot *DOMBackendNode `json:"assignedSlot,omitempty"`
}
// DOMRGBA A structure holding an RGBA color.
type DOMRGBA struct {
// R The red component, in the [0-255] range.
R int `json:"r"`
// G The green component, in the [0-255] range.
G int `json:"g"`
// B The blue component, in the [0-255] range.
B int `json:"b"`
// A (optional) The alpha component, in the [0-1] range (default: 1).
A *float64 `json:"a,omitempty"`
}
// DOMQuad An array of quad vertices, x immediately followed by y for each point, points clock-wise.
type DOMQuad []float64
// DOMBoxModel Box model.
type DOMBoxModel struct {
// Content box
Content DOMQuad `json:"content"`
// Padding box
Padding DOMQuad `json:"padding"`
// Border box
Border DOMQuad `json:"border"`
// Margin box
Margin DOMQuad `json:"margin"`
// Width Node width
Width int `json:"width"`
// Height Node height
Height int `json:"height"`
// ShapeOutside (optional) Shape outside coordinates
ShapeOutside *DOMShapeOutsideInfo `json:"shapeOutside,omitempty"`
}
// DOMShapeOutsideInfo CSS Shape Outside details.
type DOMShapeOutsideInfo struct {
// Bounds Shape bounds
Bounds DOMQuad `json:"bounds"`
// Shape coordinate details
Shape []gson.JSON `json:"shape"`
// MarginShape Margin shape bounds
MarginShape []gson.JSON `json:"marginShape"`
}
// DOMRect Rectangle.
type DOMRect struct {
// X coordinate
X float64 `json:"x"`
// Y coordinate
Y float64 `json:"y"`
// Width Rectangle width
Width float64 `json:"width"`
// Height Rectangle height
Height float64 `json:"height"`
}
// DOMCSSComputedStyleProperty ...
type DOMCSSComputedStyleProperty struct {
// Name Computed style property name.
Name string `json:"name"`
// Value Computed style property value.
Value string `json:"value"`
}
// DOMCollectClassNamesFromSubtree (experimental) Collects class names for the node with given id and all of it's child nodes.
type DOMCollectClassNamesFromSubtree struct {
// NodeID Id of the node to collect class names.
NodeID DOMNodeID `json:"nodeId"`
}
// ProtoReq name.
func (m DOMCollectClassNamesFromSubtree) ProtoReq() string { return "DOM.collectClassNamesFromSubtree" }
// Call the request.
func (m DOMCollectClassNamesFromSubtree) Call(c Client) (*DOMCollectClassNamesFromSubtreeResult, error) {
var res DOMCollectClassNamesFromSubtreeResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// DOMCollectClassNamesFromSubtreeResult (experimental) ...
type DOMCollectClassNamesFromSubtreeResult struct {
// ClassNames Class name list.
ClassNames []string `json:"classNames"`
}
// DOMCopyTo (experimental) Creates a deep copy of the specified node and places it into the target container before the
// given anchor.
type DOMCopyTo struct {
// NodeID Id of the node to copy.
NodeID DOMNodeID `json:"nodeId"`
// TargetNodeID Id of the element to drop the copy into.
TargetNodeID DOMNodeID `json:"targetNodeId"`
// InsertBeforeNodeID (optional) Drop the copy before this node (if absent, the copy becomes the last child of
// `targetNodeId`).
InsertBeforeNodeID DOMNodeID `json:"insertBeforeNodeId,omitempty"`
}
// ProtoReq name.
func (m DOMCopyTo) ProtoReq() string { return "DOM.copyTo" }
// Call the request.
func (m DOMCopyTo) Call(c Client) (*DOMCopyToResult, error) {
var res DOMCopyToResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// DOMCopyToResult (experimental) ...
type DOMCopyToResult struct {
// NodeID Id of the node clone.
NodeID DOMNodeID `json:"nodeId"`
}
// DOMDescribeNode Describes node given its id, does not require domain to be enabled. Does not start tracking any
// objects, can be used for automation.
type DOMDescribeNode struct {
// NodeID (optional) Identifier of the node.
NodeID DOMNodeID `json:"nodeId,omitempty"`
// BackendNodeID (optional) Identifier of the backend node.
BackendNodeID DOMBackendNodeID `json:"backendNodeId,omitempty"`
// ObjectID (optional) JavaScript object id of the node wrapper.
ObjectID RuntimeRemoteObjectID `json:"objectId,omitempty"`
// Depth (optional) The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the
// entire subtree or provide an integer larger than 0.
Depth *int `json:"depth,omitempty"`
// Pierce (optional) Whether or not iframes and shadow roots should be traversed when returning the subtree
// (default is false).
Pierce bool `json:"pierce,omitempty"`
}
// ProtoReq name.
func (m DOMDescribeNode) ProtoReq() string { return "DOM.describeNode" }
// Call the request.
func (m DOMDescribeNode) Call(c Client) (*DOMDescribeNodeResult, error) {
var res DOMDescribeNodeResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// DOMDescribeNodeResult ...
type DOMDescribeNodeResult struct {
// Node description.
Node *DOMNode `json:"node"`
}
// DOMScrollIntoViewIfNeeded Scrolls the specified rect of the given node into view if not already visible.
// Note: exactly one between nodeId, backendNodeId and objectId should be passed
// to identify the node.
type DOMScrollIntoViewIfNeeded struct {
// NodeID (optional) Identifier of the node.
NodeID DOMNodeID `json:"nodeId,omitempty"`
// BackendNodeID (optional) Identifier of the backend node.
BackendNodeID DOMBackendNodeID `json:"backendNodeId,omitempty"`
// ObjectID (optional) JavaScript object id of the node wrapper.
ObjectID RuntimeRemoteObjectID `json:"objectId,omitempty"`
// Rect (optional) The rect to be scrolled into view, relative to the node's border box, in CSS pixels.
// When omitted, center of the node will be used, similar to Element.scrollIntoView.
Rect *DOMRect `json:"rect,omitempty"`
}
// ProtoReq name.
func (m DOMScrollIntoViewIfNeeded) ProtoReq() string { return "DOM.scrollIntoViewIfNeeded" }
// Call sends the request.
func (m DOMScrollIntoViewIfNeeded) Call(c Client) error {
return call(m.ProtoReq(), m, nil, c)
}
// DOMDisable Disables DOM agent for the given page.
type DOMDisable struct{}
// ProtoReq name.
func (m DOMDisable) ProtoReq() string { return "DOM.disable" }
// Call sends the request.
func (m DOMDisable) Call(c Client) error {
return call(m.ProtoReq(), m, nil, c)
}
// DOMDiscardSearchResults (experimental) Discards search results from the session with the given id. `getSearchResults` should no longer
// be called for that search.
type DOMDiscardSearchResults struct {
// SearchID Unique search session identifier.
SearchID string `json:"searchId"`
}
// ProtoReq name.
func (m DOMDiscardSearchResults) ProtoReq() string { return "DOM.discardSearchResults" }
// Call sends the request.
func (m DOMDiscardSearchResults) Call(c Client) error {
return call(m.ProtoReq(), m, nil, c)
}
// DOMEnableIncludeWhitespace enum.
type DOMEnableIncludeWhitespace string
const (
// DOMEnableIncludeWhitespaceNone enum const.
DOMEnableIncludeWhitespaceNone DOMEnableIncludeWhitespace = "none"
// DOMEnableIncludeWhitespaceAll enum const.
DOMEnableIncludeWhitespaceAll DOMEnableIncludeWhitespace = "all"
)
// DOMEnable Enables DOM agent for the given page.
type DOMEnable struct {
// IncludeWhitespace (experimental) (optional) Whether to include whitespaces in the children array of returned Nodes.
IncludeWhitespace DOMEnableIncludeWhitespace `json:"includeWhitespace,omitempty"`
}
// ProtoReq name.
func (m DOMEnable) ProtoReq() string { return "DOM.enable" }
// Call sends the request.
func (m DOMEnable) Call(c Client) error {
return call(m.ProtoReq(), m, nil, c)
}
// DOMFocus Focuses the given element.
type DOMFocus struct {
// NodeID (optional) Identifier of the node.
NodeID DOMNodeID `json:"nodeId,omitempty"`
// BackendNodeID (optional) Identifier of the backend node.
BackendNodeID DOMBackendNodeID `json:"backendNodeId,omitempty"`
// ObjectID (optional) JavaScript object id of the node wrapper.
ObjectID RuntimeRemoteObjectID `json:"objectId,omitempty"`
}
// ProtoReq name.
func (m DOMFocus) ProtoReq() string { return "DOM.focus" }
// Call sends the request.
func (m DOMFocus) Call(c Client) error {
return call(m.ProtoReq(), m, nil, c)
}
// DOMGetAttributes Returns attributes for the specified node.
type DOMGetAttributes struct {
// NodeID Id of the node to retrieve attributes for.
NodeID DOMNodeID `json:"nodeId"`
}
// ProtoReq name.
func (m DOMGetAttributes) ProtoReq() string { return "DOM.getAttributes" }
// Call the request.
func (m DOMGetAttributes) Call(c Client) (*DOMGetAttributesResult, error) {
var res DOMGetAttributesResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// DOMGetAttributesResult ...
type DOMGetAttributesResult struct {
// Attributes An interleaved array of node attribute names and values.
Attributes []string `json:"attributes"`
}
// DOMGetBoxModel Returns boxes for the given node.
type DOMGetBoxModel struct {
// NodeID (optional) Identifier of the node.
NodeID DOMNodeID `json:"nodeId,omitempty"`
// BackendNodeID (optional) Identifier of the backend node.
BackendNodeID DOMBackendNodeID `json:"backendNodeId,omitempty"`
// ObjectID (optional) JavaScript object id of the node wrapper.
ObjectID RuntimeRemoteObjectID `json:"objectId,omitempty"`
}
// ProtoReq name.
func (m DOMGetBoxModel) ProtoReq() string { return "DOM.getBoxModel" }
// Call the request.
func (m DOMGetBoxModel) Call(c Client) (*DOMGetBoxModelResult, error) {
var res DOMGetBoxModelResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// DOMGetBoxModelResult ...
type DOMGetBoxModelResult struct {
// Model Box model for the node.
Model *DOMBoxModel `json:"model"`
}
// DOMGetContentQuads (experimental) Returns quads that describe node position on the page. This method
// might return multiple quads for inline nodes.
type DOMGetContentQuads struct {
// NodeID (optional) Identifier of the node.
NodeID DOMNodeID `json:"nodeId,omitempty"`
// BackendNodeID (optional) Identifier of the backend node.
BackendNodeID DOMBackendNodeID `json:"backendNodeId,omitempty"`
// ObjectID (optional) JavaScript object id of the node wrapper.
ObjectID RuntimeRemoteObjectID `json:"objectId,omitempty"`
}
// ProtoReq name.
func (m DOMGetContentQuads) ProtoReq() string { return "DOM.getContentQuads" }
// Call the request.
func (m DOMGetContentQuads) Call(c Client) (*DOMGetContentQuadsResult, error) {
var res DOMGetContentQuadsResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// DOMGetContentQuadsResult (experimental) ...
type DOMGetContentQuadsResult struct {
// Quads that describe node layout relative to viewport.
Quads []DOMQuad `json:"quads"`
}
// DOMGetDocument Returns the root DOM node (and optionally the subtree) to the caller.
// Implicitly enables the DOM domain events for the current target.
type DOMGetDocument struct {
// Depth (optional) The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the
// entire subtree or provide an integer larger than 0.
Depth *int `json:"depth,omitempty"`
// Pierce (optional) Whether or not iframes and shadow roots should be traversed when returning the subtree
// (default is false).
Pierce bool `json:"pierce,omitempty"`
}
// ProtoReq name.
func (m DOMGetDocument) ProtoReq() string { return "DOM.getDocument" }
// Call the request.
func (m DOMGetDocument) Call(c Client) (*DOMGetDocumentResult, error) {
var res DOMGetDocumentResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// DOMGetDocumentResult ...
type DOMGetDocumentResult struct {
// Root Resulting node.
Root *DOMNode `json:"root"`
}
// DOMGetFlattenedDocument (deprecated) Returns the root DOM node (and optionally the subtree) to the caller.
// Deprecated, as it is not designed to work well with the rest of the DOM agent.
// Use DOMSnapshot.captureSnapshot instead.
type DOMGetFlattenedDocument struct {
// Depth (optional) The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the
// entire subtree or provide an integer larger than 0.
Depth *int `json:"depth,omitempty"`
// Pierce (optional) Whether or not iframes and shadow roots should be traversed when returning the subtree
// (default is false).
Pierce bool `json:"pierce,omitempty"`
}
// ProtoReq name.
func (m DOMGetFlattenedDocument) ProtoReq() string { return "DOM.getFlattenedDocument" }
// Call the request.
func (m DOMGetFlattenedDocument) Call(c Client) (*DOMGetFlattenedDocumentResult, error) {
var res DOMGetFlattenedDocumentResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// DOMGetFlattenedDocumentResult (deprecated) ...
type DOMGetFlattenedDocumentResult struct {
// Nodes Resulting node.
Nodes []*DOMNode `json:"nodes"`
}
// DOMGetNodesForSubtreeByStyle (experimental) Finds nodes with a given computed style in a subtree.
type DOMGetNodesForSubtreeByStyle struct {
// NodeID Node ID pointing to the root of a subtree.
NodeID DOMNodeID `json:"nodeId"`
// ComputedStyles The style to filter nodes by (includes nodes if any of properties matches).
ComputedStyles []*DOMCSSComputedStyleProperty `json:"computedStyles"`
// Pierce (optional) Whether or not iframes and shadow roots in the same target should be traversed when returning the
// results (default is false).
Pierce bool `json:"pierce,omitempty"`
}
// ProtoReq name.
func (m DOMGetNodesForSubtreeByStyle) ProtoReq() string { return "DOM.getNodesForSubtreeByStyle" }
// Call the request.
func (m DOMGetNodesForSubtreeByStyle) Call(c Client) (*DOMGetNodesForSubtreeByStyleResult, error) {
var res DOMGetNodesForSubtreeByStyleResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// DOMGetNodesForSubtreeByStyleResult (experimental) ...
type DOMGetNodesForSubtreeByStyleResult struct {
// NodeIDs Resulting nodes.
NodeIDs []DOMNodeID `json:"nodeIds"`
}
// DOMGetNodeForLocation Returns node id at given location. Depending on whether DOM domain is enabled, nodeId is
// either returned or not.
type DOMGetNodeForLocation struct {
// X coordinate.
X int `json:"x"`
// Y coordinate.
Y int `json:"y"`
// IncludeUserAgentShadowDOM (optional) False to skip to the nearest non-UA shadow root ancestor (default: false).
IncludeUserAgentShadowDOM bool `json:"includeUserAgentShadowDOM,omitempty"`
// IgnorePointerEventsNone (optional) Whether to ignore pointer-events: none on elements and hit test them.
IgnorePointerEventsNone bool `json:"ignorePointerEventsNone,omitempty"`
}
// ProtoReq name.
func (m DOMGetNodeForLocation) ProtoReq() string { return "DOM.getNodeForLocation" }
// Call the request.
func (m DOMGetNodeForLocation) Call(c Client) (*DOMGetNodeForLocationResult, error) {
var res DOMGetNodeForLocationResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// DOMGetNodeForLocationResult ...
type DOMGetNodeForLocationResult struct {
// BackendNodeID Resulting node.
BackendNodeID DOMBackendNodeID `json:"backendNodeId"`
// FrameID Frame this node belongs to.
FrameID PageFrameID `json:"frameId"`
// NodeID (optional) Id of the node at given coordinates, only when enabled and requested document.
NodeID DOMNodeID `json:"nodeId,omitempty"`
}
// DOMGetOuterHTML Returns node's HTML markup.
type DOMGetOuterHTML struct {
// NodeID (optional) Identifier of the node.
NodeID DOMNodeID `json:"nodeId,omitempty"`
// BackendNodeID (optional) Identifier of the backend node.
BackendNodeID DOMBackendNodeID `json:"backendNodeId,omitempty"`
// ObjectID (optional) JavaScript object id of the node wrapper.
ObjectID RuntimeRemoteObjectID `json:"objectId,omitempty"`
}
// ProtoReq name.
func (m DOMGetOuterHTML) ProtoReq() string { return "DOM.getOuterHTML" }
// Call the request.
func (m DOMGetOuterHTML) Call(c Client) (*DOMGetOuterHTMLResult, error) {
var res DOMGetOuterHTMLResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// DOMGetOuterHTMLResult ...
type DOMGetOuterHTMLResult struct {
// OuterHTML Outer HTML markup.
OuterHTML string `json:"outerHTML"`
}
// DOMGetRelayoutBoundary (experimental) Returns the id of the nearest ancestor that is a relayout boundary.
type DOMGetRelayoutBoundary struct {
// NodeID Id of the node.
NodeID DOMNodeID `json:"nodeId"`
}
// ProtoReq name.
func (m DOMGetRelayoutBoundary) ProtoReq() string { return "DOM.getRelayoutBoundary" }
// Call the request.
func (m DOMGetRelayoutBoundary) Call(c Client) (*DOMGetRelayoutBoundaryResult, error) {
var res DOMGetRelayoutBoundaryResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// DOMGetRelayoutBoundaryResult (experimental) ...
type DOMGetRelayoutBoundaryResult struct {
// NodeID Relayout boundary node id for the given node.
NodeID DOMNodeID `json:"nodeId"`
}
// DOMGetSearchResults (experimental) Returns search results from given `fromIndex` to given `toIndex` from the search with the given
// identifier.
type DOMGetSearchResults struct {
// SearchID Unique search session identifier.
SearchID string `json:"searchId"`
// FromIndex Start index of the search result to be returned.
FromIndex int `json:"fromIndex"`
// ToIndex End index of the search result to be returned.
ToIndex int `json:"toIndex"`
}
// ProtoReq name.
func (m DOMGetSearchResults) ProtoReq() string { return "DOM.getSearchResults" }
// Call the request.
func (m DOMGetSearchResults) Call(c Client) (*DOMGetSearchResultsResult, error) {
var res DOMGetSearchResultsResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// DOMGetSearchResultsResult (experimental) ...
type DOMGetSearchResultsResult struct {
// NodeIDs Ids of the search result nodes.
NodeIDs []DOMNodeID `json:"nodeIds"`
}
// DOMHideHighlight Hides any highlight.
type DOMHideHighlight struct{}
// ProtoReq name.
func (m DOMHideHighlight) ProtoReq() string { return "DOM.hideHighlight" }
// Call sends the request.
func (m DOMHideHighlight) Call(c Client) error {
return call(m.ProtoReq(), m, nil, c)
}
// DOMHighlightNode Highlights DOM node.
type DOMHighlightNode struct{}
// ProtoReq name.
func (m DOMHighlightNode) ProtoReq() string { return "DOM.highlightNode" }
// Call sends the request.
func (m DOMHighlightNode) Call(c Client) error {
return call(m.ProtoReq(), m, nil, c)
}
// DOMHighlightRect Highlights given rectangle.
type DOMHighlightRect struct{}
// ProtoReq name.
func (m DOMHighlightRect) ProtoReq() string { return "DOM.highlightRect" }
// Call sends the request.
func (m DOMHighlightRect) Call(c Client) error {
return call(m.ProtoReq(), m, nil, c)
}
// DOMMarkUndoableState (experimental) Marks last undoable state.
type DOMMarkUndoableState struct{}
// ProtoReq name.
func (m DOMMarkUndoableState) ProtoReq() string { return "DOM.markUndoableState" }
// Call sends the request.
func (m DOMMarkUndoableState) Call(c Client) error {
return call(m.ProtoReq(), m, nil, c)
}
// DOMMoveTo Moves node into the new container, places it before the given anchor.
type DOMMoveTo struct {
// NodeID Id of the node to move.
NodeID DOMNodeID `json:"nodeId"`
// TargetNodeID Id of the element to drop the moved node into.
TargetNodeID DOMNodeID `json:"targetNodeId"`
// InsertBeforeNodeID (optional) Drop node before this one (if absent, the moved node becomes the last child of
// `targetNodeId`).
InsertBeforeNodeID DOMNodeID `json:"insertBeforeNodeId,omitempty"`
}
// ProtoReq name.
func (m DOMMoveTo) ProtoReq() string { return "DOM.moveTo" }
// Call the request.
func (m DOMMoveTo) Call(c Client) (*DOMMoveToResult, error) {
var res DOMMoveToResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// DOMMoveToResult ...
type DOMMoveToResult struct {
// NodeID New id of the moved node.
NodeID DOMNodeID `json:"nodeId"`
}
// DOMPerformSearch (experimental) Searches for a given string in the DOM tree. Use `getSearchResults` to access search results or
// `cancelSearch` to end this search session.
type DOMPerformSearch struct {
// Query Plain text or query selector or XPath search query.
Query string `json:"query"`
// IncludeUserAgentShadowDOM (optional) True to search in user agent shadow DOM.
IncludeUserAgentShadowDOM bool `json:"includeUserAgentShadowDOM,omitempty"`
}
// ProtoReq name.
func (m DOMPerformSearch) ProtoReq() string { return "DOM.performSearch" }
// Call the request.
func (m DOMPerformSearch) Call(c Client) (*DOMPerformSearchResult, error) {
var res DOMPerformSearchResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// DOMPerformSearchResult (experimental) ...
type DOMPerformSearchResult struct {
// SearchID Unique search session identifier.
SearchID string `json:"searchId"`
// ResultCount Number of search results.
ResultCount int `json:"resultCount"`
}
// DOMPushNodeByPathToFrontend (experimental) Requests that the node is sent to the caller given its path. // FIXME, use XPath.
type DOMPushNodeByPathToFrontend struct {
// Path to node in the proprietary format.
Path string `json:"path"`
}
// ProtoReq name.
func (m DOMPushNodeByPathToFrontend) ProtoReq() string { return "DOM.pushNodeByPathToFrontend" }
// Call the request.
func (m DOMPushNodeByPathToFrontend) Call(c Client) (*DOMPushNodeByPathToFrontendResult, error) {
var res DOMPushNodeByPathToFrontendResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// DOMPushNodeByPathToFrontendResult (experimental) ...
type DOMPushNodeByPathToFrontendResult struct {
// NodeID Id of the node for given path.
NodeID DOMNodeID `json:"nodeId"`
}
// DOMPushNodesByBackendIDsToFrontend (experimental) Requests that a batch of nodes is sent to the caller given their backend node ids.
type DOMPushNodesByBackendIDsToFrontend struct {
// BackendNodeIDs The array of backend node ids.
BackendNodeIDs []DOMBackendNodeID `json:"backendNodeIds"`
}
// ProtoReq name.
func (m DOMPushNodesByBackendIDsToFrontend) ProtoReq() string {
return "DOM.pushNodesByBackendIdsToFrontend"
}
// Call the request.
func (m DOMPushNodesByBackendIDsToFrontend) Call(c Client) (*DOMPushNodesByBackendIDsToFrontendResult, error) {
var res DOMPushNodesByBackendIDsToFrontendResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// DOMPushNodesByBackendIDsToFrontendResult (experimental) ...
type DOMPushNodesByBackendIDsToFrontendResult struct {
// NodeIDs The array of ids of pushed nodes that correspond to the backend ids specified in
// backendNodeIds.
NodeIDs []DOMNodeID `json:"nodeIds"`
}
// DOMQuerySelector Executes `querySelector` on a given node.
type DOMQuerySelector struct {
// NodeID Id of the node to query upon.
NodeID DOMNodeID `json:"nodeId"`
// Selector string.
Selector string `json:"selector"`
}
// ProtoReq name.
func (m DOMQuerySelector) ProtoReq() string { return "DOM.querySelector" }
// Call the request.
func (m DOMQuerySelector) Call(c Client) (*DOMQuerySelectorResult, error) {
var res DOMQuerySelectorResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// DOMQuerySelectorResult ...
type DOMQuerySelectorResult struct {
// NodeID Query selector result.
NodeID DOMNodeID `json:"nodeId"`
}
// DOMQuerySelectorAll Executes `querySelectorAll` on a given node.
type DOMQuerySelectorAll struct {