-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbrowsertelemetry.go
More file actions
6652 lines (6291 loc) · 299 KB
/
Copy pathbrowsertelemetry.go
File metadata and controls
6652 lines (6291 loc) · 299 KB
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
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package kernel
import (
"context"
"encoding/json"
"errors"
"fmt"
"net/http"
"net/url"
"slices"
"github.com/kernel/kernel-go-sdk/internal/apijson"
"github.com/kernel/kernel-go-sdk/internal/apiquery"
"github.com/kernel/kernel-go-sdk/internal/requestconfig"
"github.com/kernel/kernel-go-sdk/option"
"github.com/kernel/kernel-go-sdk/packages/pagination"
"github.com/kernel/kernel-go-sdk/packages/param"
"github.com/kernel/kernel-go-sdk/packages/respjson"
"github.com/kernel/kernel-go-sdk/packages/ssestream"
"github.com/kernel/kernel-go-sdk/shared/constant"
)
// Stream live telemetry events from a browser session, and manage the destinations
// sessions export them to.
//
// BrowserTelemetryService contains methods and other services that help with
// interacting with the kernel API.
//
// Note, unlike clients, this service does not read variables from the environment
// automatically. You should not instantiate this service directly, and instead use
// the [NewBrowserTelemetryService] method instead.
type BrowserTelemetryService struct {
Options []option.RequestOption
}
// NewBrowserTelemetryService generates a new service that applies the given
// options to each request. These options are applied after the parent client's
// options (if there is one), and before any request-specific options.
func NewBrowserTelemetryService(opts ...option.RequestOption) (r BrowserTelemetryService) {
r = BrowserTelemetryService{}
r.Options = opts
return
}
// Reads a page of telemetry events for the browser session. To page through
// results, pass the X-Next-Offset value from the previous response as offset and
// repeat while X-Has-More is true. Returns an empty list when telemetry data is
// unavailable.
func (r *BrowserTelemetryService) Events(ctx context.Context, id string, query BrowserTelemetryEventsParams, opts ...option.RequestOption) (res *pagination.OffsetPagination[BrowserTelemetryEventsResponse], err error) {
var raw *http.Response
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
if id == "" {
err = errors.New("missing required id parameter")
return nil, err
}
path := fmt.Sprintf("browsers/%s/telemetry/events", id)
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
if err != nil {
return nil, err
}
err = cfg.Execute()
if err != nil {
return nil, err
}
res.SetPageConfig(cfg, raw)
return res, nil
}
// Reads a page of telemetry events for the browser session. To page through
// results, pass the X-Next-Offset value from the previous response as offset and
// repeat while X-Has-More is true. Returns an empty list when telemetry data is
// unavailable.
func (r *BrowserTelemetryService) EventsAutoPaging(ctx context.Context, id string, query BrowserTelemetryEventsParams, opts ...option.RequestOption) *pagination.OffsetPaginationAutoPager[BrowserTelemetryEventsResponse] {
return pagination.NewOffsetPaginationAutoPager(r.Events(ctx, id, query, opts...))
}
// Streams browser telemetry events as a server-sent events (SSE) stream. The
// stream closes when the browser session terminates. Each event frame includes an
// id: field containing a monotonically increasing sequence number; pass it as
// Last-Event-ID on reconnect to resume without gaps. The event: field is never
// set; all frames carry JSON in the data: field. A keepalive comment frame is sent
// every 15 seconds when no events arrive. Returns 404 if the browser session does
// not exist. If telemetry was not enabled on the session, the stream opens but no
// events are delivered. Fresh connections only see new events; pass replay=all to
// start from the oldest retained event instead.
func (r *BrowserTelemetryService) StreamStreaming(ctx context.Context, id string, params BrowserTelemetryStreamParams, opts ...option.RequestOption) (stream *ssestream.Stream[BrowserTelemetryStreamResponse]) {
var (
raw *http.Response
err error
)
if !param.IsOmitted(params.LastEventID) {
opts = append(opts, option.WithHeader("Last-Event-ID", fmt.Sprintf("%v", params.LastEventID.Value)))
}
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "text/event-stream")}, opts...)
if id == "" {
err = errors.New("missing required id parameter")
return ssestream.NewStream[BrowserTelemetryStreamResponse](nil, err)
}
path := fmt.Sprintf("browsers/%s/telemetry/stream", id)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, params, &raw, opts...)
return ssestream.NewStream[BrowserTelemetryStreamResponse](ssestream.NewDecoder(raw), err)
}
// An agent-driven HTTP call that drives the browser, handled by the in-VM API
// server. Calls that manage the VM instead emit platform_api_call.
type BrowserAPICallEvent struct {
Category constant.Control `json:"category" default:"control"`
// Provenance metadata identifying which producer emitted the event.
Source BrowserEventSource `json:"source" api:"required"`
// Event timestamp in Unix microseconds.
Ts int64 `json:"ts" api:"required"`
Type constant.APICall `json:"type" default:"api_call"`
Data BrowserAPICallEventData `json:"data"`
// True if the data field was truncated due to size limits.
Truncated bool `json:"truncated"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Category respjson.Field
Source respjson.Field
Ts respjson.Field
Type respjson.Field
Data respjson.Field
Truncated respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
func (r BrowserAPICallEvent) RawJSON() string { return r.JSON.raw }
func (r *BrowserAPICallEvent) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
type BrowserAPICallEventData struct {
// Wall-clock duration of the handler in milliseconds.
DurationMs float64 `json:"duration_ms" api:"required"`
// Matched route's operation, named as the in-VM API names its handler (e.g.
// ProcessExec, TakeScreenshot).
OperationID string `json:"operation_id" api:"required"`
// Per-request identifier from the in-VM API request middleware.
RequestID string `json:"request_id" api:"required"`
// HTTP response status code.
Status int64 `json:"status" api:"required"`
// Source submitted to the Playwright code-execution endpoint, capped at 8192 bytes
// like every other captured string. A capped value is cut on a character boundary
// and ends in `...[truncated]`. Absent for every other operation.
Code string `json:"code"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
DurationMs respjson.Field
OperationID respjson.Field
RequestID respjson.Field
Status respjson.Field
Code respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
func (r BrowserAPICallEventData) RawJSON() string { return r.JSON.raw }
func (r *BrowserAPICallEventData) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// CDP Runtime.StackTrace representing the JavaScript call stack at the time of an
// event. Fields use CDP naming conventions rather than snake_case to match the
// Chrome DevTools Protocol wire format.
type BrowserCallStack struct {
// Ordered list of call frames, outermost first.
CallFrames []BrowserCallStackCallFrame `json:"callFrames" api:"required"`
// Optional label for the stack trace (e.g. async cause).
Description string `json:"description"`
// Parent stack trace for async stacks.
Parent *BrowserCallStack `json:"parent"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CallFrames respjson.Field
Description respjson.Field
Parent respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
func (r BrowserCallStack) RawJSON() string { return r.JSON.raw }
func (r *BrowserCallStack) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
type BrowserCallStackCallFrame struct {
// Zero-based column number within the line.
ColumnNumber int64 `json:"columnNumber" api:"required"`
// JavaScript function name, or empty string for anonymous functions.
FunctionName string `json:"functionName" api:"required"`
// Zero-based line number within the script.
LineNumber int64 `json:"lineNumber" api:"required"`
// CDP script identifier.
ScriptID string `json:"scriptId" api:"required"`
// URL or name of the script file.
URL string `json:"url" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ColumnNumber respjson.Field
FunctionName respjson.Field
LineNumber respjson.Field
ScriptID respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
func (r BrowserCallStackCallFrame) RawJSON() string { return r.JSON.raw }
func (r *BrowserCallStackCallFrame) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// A captcha solve attempt reached a terminal outcome.
type BrowserCaptchaSolveResultEvent struct {
Category constant.Captcha `json:"category" default:"captcha"`
// Provenance metadata identifying which producer emitted the event.
Source BrowserEventSource `json:"source" api:"required"`
// Event timestamp in Unix microseconds.
Ts int64 `json:"ts" api:"required"`
Type constant.CaptchaSolveResult `json:"type" default:"captcha_solve_result"`
Data BrowserCaptchaSolveResultEventData `json:"data"`
// True if the data field was truncated due to size limits.
Truncated bool `json:"truncated"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Category respjson.Field
Source respjson.Field
Ts respjson.Field
Type respjson.Field
Data respjson.Field
Truncated respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
func (r BrowserCaptchaSolveResultEvent) RawJSON() string { return r.JSON.raw }
func (r *BrowserCaptchaSolveResultEvent) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
type BrowserCaptchaSolveResultEventData struct {
// Captcha vendor family. Provider-specific task names are normalized into this
// set; anything not covered is reported as other.
//
// Any of "hcaptcha", "recaptcha_v2", "recaptcha_v3", "turnstile", "geetest",
// "other".
CaptchaType string `json:"captcha_type" api:"required"`
// Wall-clock duration from solve start to terminal outcome.
DurationMs float64 `json:"duration_ms" api:"required"`
// Terminal outcome. success: solver returned a usable solution. failure: solver
// returned an error (see error_code). timeout: solver did not return within the
// caller's wait budget. abandoned: caller cancelled or the page navigated away
// mid-solve.
//
// Any of "success", "failure", "timeout", "abandoned".
Status string `json:"status" api:"required"`
// Solver-specific error code on failure (e.g. ERROR_CAPTCHA_UNSOLVABLE). Absent on
// success.
ErrorCode string `json:"error_code"`
// Solver-assigned identifier. Opaque, useful for support cross-references.
TaskID string `json:"task_id"`
// Host of the page where the captcha was solved.
WebsiteHost string `json:"website_host"`
// Path of the page where the captcha was solved. Query string excluded.
WebsitePath string `json:"website_path"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CaptchaType respjson.Field
DurationMs respjson.Field
Status respjson.Field
ErrorCode respjson.Field
TaskID respjson.Field
WebsiteHost respjson.Field
WebsitePath respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
func (r BrowserCaptchaSolveResultEventData) RawJSON() string { return r.JSON.raw }
func (r *BrowserCaptchaSolveResultEventData) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// A browser-control command a client sent over the CDP WebSocket proxy: input
// gestures, navigation, dialog handling, file selection and screenshots.
// Configuration commands and the DOM/Runtime traffic a client library issues on
// the caller's behalf are not reported. One event per browser-control command that
// reached the browser. The command stream is not sampled, coalesced or reordered.
// An event is lost only when the method is excluded by telemetry configuration,
// when the command's arguments do not decode, or when classification cannot keep
// up. Exclusions are counted in `cdp_disconnect.telemetry_excluded`; the rest in
// `cdp_disconnect.telemetry_dropped`.
type BrowserCdpCommandEvent struct {
Category constant.Control `json:"category" default:"control"`
// Per-command payload for `cdp_command` events, discriminated by `method`. Each
// variant carries only the arguments approved for that command: values that could
// hold a secret — typed and composition text, URLs, referrers, scripts, templates,
// file paths, drag contents and autofill values — are replaced by a length, a
// count, a presence flag, an enum or a URL scheme and host.
Data BrowserCdpCommandEventDataUnion `json:"data" api:"required"`
// Provenance metadata identifying which producer emitted the event.
Source BrowserEventSource `json:"source" api:"required"`
// Event timestamp in Unix microseconds.
Ts int64 `json:"ts" api:"required"`
Type constant.CdpCommand `json:"type" default:"cdp_command"`
// True if the data field was truncated due to size limits.
Truncated bool `json:"truncated"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Category respjson.Field
Data respjson.Field
Source respjson.Field
Ts respjson.Field
Type respjson.Field
Truncated respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
func (r BrowserCdpCommandEvent) RawJSON() string { return r.JSON.raw }
func (r *BrowserCdpCommandEvent) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// BrowserCdpCommandEventDataUnion contains all possible properties and values from
// [BrowserCdpCommandEventDataInputDispatchMouseEvent],
// [BrowserCdpCommandEventDataInputDispatchKeyEvent],
// [BrowserCdpCommandEventDataInputInsertText],
// [BrowserCdpCommandEventDataInputImeSetComposition],
// [BrowserCdpCommandEventDataInputDispatchTouchEvent],
// [BrowserCdpCommandEventDataInputDispatchDragEvent],
// [BrowserCdpCommandEventDataInputCancelDragging],
// [BrowserCdpCommandEventDataInputEmulateTouchFromMouseEvent],
// [BrowserCdpCommandEventDataInputSynthesizePinchGesture],
// [BrowserCdpCommandEventDataInputSynthesizeScrollGesture],
// [BrowserCdpCommandEventDataInputSynthesizeTapGesture],
// [BrowserCdpCommandEventDataDomSetFileInputFiles],
// [BrowserCdpCommandEventDataDomFocus],
// [BrowserCdpCommandEventDataDomScrollIntoViewIfNeeded],
// [BrowserCdpCommandEventDataPageBringToFront],
// [BrowserCdpCommandEventDataPageCaptureScreenshot],
// [BrowserCdpCommandEventDataPageCaptureSnapshot],
// [BrowserCdpCommandEventDataPageHandleJavaScriptDialog],
// [BrowserCdpCommandEventDataPageNavigate],
// [BrowserCdpCommandEventDataPageNavigateToHistoryEntry],
// [BrowserCdpCommandEventDataPageReload],
// [BrowserCdpCommandEventDataPagePrintToPdf],
// [BrowserCdpCommandEventDataPageStartScreencast],
// [BrowserCdpCommandEventDataPageStopScreencast],
// [BrowserCdpCommandEventDataPageStopLoading],
// [BrowserCdpCommandEventDataPageClose],
// [BrowserCdpCommandEventDataPageSetWebLifecycleState],
// [BrowserCdpCommandEventDataTargetActivateTarget],
// [BrowserCdpCommandEventDataTargetCloseTarget],
// [BrowserCdpCommandEventDataTargetCreateTarget],
// [BrowserCdpCommandEventDataTargetCreateBrowserContext],
// [BrowserCdpCommandEventDataTargetDisposeBrowserContext],
// [BrowserCdpCommandEventDataTargetOpenDevTools],
// [BrowserCdpCommandEventDataBrowserCancelDownload],
// [BrowserCdpCommandEventDataBrowserClose],
// [BrowserCdpCommandEventDataBrowserSetWindowBounds],
// [BrowserCdpCommandEventDataBrowserSetContentsSize],
// [BrowserCdpCommandEventDataAutofillTrigger].
//
// Use the [BrowserCdpCommandEventDataUnion.AsAny] method to switch on the variant.
//
// Use the methods beginning with 'As' to cast the union to one of its variants.
type BrowserCdpCommandEventDataUnion struct {
EventType string `json:"event_type"`
// Any of "Input.dispatchMouseEvent", "Input.dispatchKeyEvent", "Input.insertText",
// "Input.imeSetComposition", "Input.dispatchTouchEvent",
// "Input.dispatchDragEvent", "Input.cancelDragging",
// "Input.emulateTouchFromMouseEvent", "Input.synthesizePinchGesture",
// "Input.synthesizeScrollGesture", "Input.synthesizeTapGesture",
// "DOM.setFileInputFiles", "DOM.focus", "DOM.scrollIntoViewIfNeeded",
// "Page.bringToFront", "Page.captureScreenshot", "Page.captureSnapshot",
// "Page.handleJavaScriptDialog", "Page.navigate", "Page.navigateToHistoryEntry",
// "Page.reload", "Page.printToPDF", "Page.startScreencast", "Page.stopScreencast",
// "Page.stopLoading", "Page.close", "Page.setWebLifecycleState",
// "Target.activateTarget", "Target.closeTarget", "Target.createTarget",
// "Target.createBrowserContext", "Target.disposeBrowserContext",
// "Target.openDevTools", "Browser.cancelDownload", "Browser.close",
// "Browser.setWindowBounds", "Browser.setContentsSize", "Autofill.trigger".
Method string `json:"method"`
Button string `json:"button"`
// This field is from variant [BrowserCdpCommandEventDataInputDispatchMouseEvent].
Buttons int64 `json:"buttons"`
ClickCount int64 `json:"click_count"`
CommandID int64 `json:"command_id"`
ConnectionID string `json:"connection_id"`
DeltaX float64 `json:"delta_x"`
DeltaY float64 `json:"delta_y"`
Force float64 `json:"force"`
Modifiers int64 `json:"modifiers"`
// This field is from variant [BrowserCdpCommandEventDataInputDispatchMouseEvent].
PointerType string `json:"pointer_type"`
SessionID string `json:"session_id"`
TangentialPressure float64 `json:"tangential_pressure"`
TiltX float64 `json:"tilt_x"`
TiltY float64 `json:"tilt_y"`
Twist int64 `json:"twist"`
X float64 `json:"x"`
Y float64 `json:"y"`
// This field is from variant [BrowserCdpCommandEventDataInputDispatchKeyEvent].
AutoRepeat bool `json:"auto_repeat"`
// This field is from variant [BrowserCdpCommandEventDataInputDispatchKeyEvent].
CommandCount int64 `json:"command_count"`
// This field is from variant [BrowserCdpCommandEventDataInputDispatchKeyEvent].
IsKeypad bool `json:"is_keypad"`
// This field is from variant [BrowserCdpCommandEventDataInputDispatchKeyEvent].
IsSystemKey bool `json:"is_system_key"`
// This field is from variant [BrowserCdpCommandEventDataInputDispatchKeyEvent].
Location int64 `json:"location"`
// This field is from variant [BrowserCdpCommandEventDataInputDispatchKeyEvent].
NamedKey string `json:"named_key"`
TextLength int64 `json:"text_length"`
// This field is from variant [BrowserCdpCommandEventDataInputImeSetComposition].
ReplacementEnd int64 `json:"replacement_end"`
// This field is from variant [BrowserCdpCommandEventDataInputImeSetComposition].
ReplacementStart int64 `json:"replacement_start"`
// This field is from variant [BrowserCdpCommandEventDataInputImeSetComposition].
SelectionEnd int64 `json:"selection_end"`
// This field is from variant [BrowserCdpCommandEventDataInputImeSetComposition].
SelectionStart int64 `json:"selection_start"`
// This field is from variant [BrowserCdpCommandEventDataInputDispatchTouchEvent].
TouchPointCount int64 `json:"touch_point_count"`
// This field is from variant [BrowserCdpCommandEventDataInputDispatchTouchEvent].
RadiusX float64 `json:"radius_x"`
// This field is from variant [BrowserCdpCommandEventDataInputDispatchTouchEvent].
RadiusY float64 `json:"radius_y"`
// This field is from variant [BrowserCdpCommandEventDataInputDispatchTouchEvent].
RotationAngle float64 `json:"rotation_angle"`
// This field is from variant [BrowserCdpCommandEventDataInputDispatchDragEvent].
DragFileCount int64 `json:"drag_file_count"`
// This field is from variant [BrowserCdpCommandEventDataInputDispatchDragEvent].
DragItemCount int64 `json:"drag_item_count"`
// This field is from variant [BrowserCdpCommandEventDataInputDispatchDragEvent].
DragMimeCategories []string `json:"drag_mime_categories"`
// This field is from variant [BrowserCdpCommandEventDataInputDispatchDragEvent].
DragOperationsMask int64 `json:"drag_operations_mask"`
GestureSourceType string `json:"gesture_source_type"`
// This field is from variant
// [BrowserCdpCommandEventDataInputSynthesizePinchGesture].
RelativeSpeed int64 `json:"relative_speed"`
// This field is from variant
// [BrowserCdpCommandEventDataInputSynthesizePinchGesture].
ScaleFactor float64 `json:"scale_factor"`
// This field is from variant
// [BrowserCdpCommandEventDataInputSynthesizeScrollGesture].
PreventFling bool `json:"prevent_fling"`
// This field is from variant
// [BrowserCdpCommandEventDataInputSynthesizeScrollGesture].
RepeatCount int64 `json:"repeat_count"`
// This field is from variant
// [BrowserCdpCommandEventDataInputSynthesizeScrollGesture].
RepeatDelayMs int64 `json:"repeat_delay_ms"`
// This field is from variant
// [BrowserCdpCommandEventDataInputSynthesizeScrollGesture].
Speed int64 `json:"speed"`
// This field is from variant
// [BrowserCdpCommandEventDataInputSynthesizeScrollGesture].
XDistance float64 `json:"x_distance"`
// This field is from variant
// [BrowserCdpCommandEventDataInputSynthesizeScrollGesture].
XOverscroll float64 `json:"x_overscroll"`
// This field is from variant
// [BrowserCdpCommandEventDataInputSynthesizeScrollGesture].
YDistance float64 `json:"y_distance"`
// This field is from variant
// [BrowserCdpCommandEventDataInputSynthesizeScrollGesture].
YOverscroll float64 `json:"y_overscroll"`
// This field is from variant
// [BrowserCdpCommandEventDataInputSynthesizeTapGesture].
Duration int64 `json:"duration"`
// This field is from variant
// [BrowserCdpCommandEventDataInputSynthesizeTapGesture].
TapCount int64 `json:"tap_count"`
// This field is from variant [BrowserCdpCommandEventDataDomSetFileInputFiles].
FileCount int64 `json:"file_count"`
BackendNodeID int64 `json:"backend_node_id"`
NodeID int64 `json:"node_id"`
ObjectID string `json:"object_id"`
// This field is from variant
// [BrowserCdpCommandEventDataDomScrollIntoViewIfNeeded].
RectHeight float64 `json:"rect_height"`
// This field is from variant
// [BrowserCdpCommandEventDataDomScrollIntoViewIfNeeded].
RectWidth float64 `json:"rect_width"`
// This field is from variant
// [BrowserCdpCommandEventDataDomScrollIntoViewIfNeeded].
RectX float64 `json:"rect_x"`
// This field is from variant
// [BrowserCdpCommandEventDataDomScrollIntoViewIfNeeded].
RectY float64 `json:"rect_y"`
// This field is from variant [BrowserCdpCommandEventDataPageCaptureScreenshot].
CaptureBeyondViewport bool `json:"capture_beyond_viewport"`
// This field is from variant [BrowserCdpCommandEventDataPageCaptureScreenshot].
ClipHeight float64 `json:"clip_height"`
// This field is from variant [BrowserCdpCommandEventDataPageCaptureScreenshot].
ClipScale float64 `json:"clip_scale"`
// This field is from variant [BrowserCdpCommandEventDataPageCaptureScreenshot].
ClipWidth float64 `json:"clip_width"`
// This field is from variant [BrowserCdpCommandEventDataPageCaptureScreenshot].
ClipX float64 `json:"clip_x"`
// This field is from variant [BrowserCdpCommandEventDataPageCaptureScreenshot].
ClipY float64 `json:"clip_y"`
Format string `json:"format"`
// This field is from variant [BrowserCdpCommandEventDataPageCaptureScreenshot].
FromSurface bool `json:"from_surface"`
// This field is from variant [BrowserCdpCommandEventDataPageCaptureScreenshot].
OptimizeForSpeed bool `json:"optimize_for_speed"`
Quality int64 `json:"quality"`
// This field is from variant
// [BrowserCdpCommandEventDataPageHandleJavaScriptDialog].
Accept bool `json:"accept"`
// This field is from variant
// [BrowserCdpCommandEventDataPageHandleJavaScriptDialog].
PromptTextLength int64 `json:"prompt_text_length"`
FrameID string `json:"frame_id"`
// This field is from variant [BrowserCdpCommandEventDataPageNavigate].
ReferrerPolicy string `json:"referrer_policy"`
// This field is from variant [BrowserCdpCommandEventDataPageNavigate].
ReferrerPresent bool `json:"referrer_present"`
// This field is from variant [BrowserCdpCommandEventDataPageNavigate].
TransitionType string `json:"transition_type"`
URLScheme string `json:"url_scheme"`
// This field is from variant
// [BrowserCdpCommandEventDataPageNavigateToHistoryEntry].
EntryID int64 `json:"entry_id"`
// This field is from variant [BrowserCdpCommandEventDataPageReload].
IgnoreCache bool `json:"ignore_cache"`
// This field is from variant [BrowserCdpCommandEventDataPageReload].
LoaderID string `json:"loader_id"`
// This field is from variant [BrowserCdpCommandEventDataPageReload].
ScriptLength int64 `json:"script_length"`
// This field is from variant [BrowserCdpCommandEventDataPagePrintToPdf].
DisplayHeaderFooter bool `json:"display_header_footer"`
// This field is from variant [BrowserCdpCommandEventDataPagePrintToPdf].
FooterTemplatePresent bool `json:"footer_template_present"`
// This field is from variant [BrowserCdpCommandEventDataPagePrintToPdf].
GenerateDocumentOutline bool `json:"generate_document_outline"`
// This field is from variant [BrowserCdpCommandEventDataPagePrintToPdf].
GenerateTaggedPdf bool `json:"generate_tagged_pdf"`
// This field is from variant [BrowserCdpCommandEventDataPagePrintToPdf].
HeaderTemplatePresent bool `json:"header_template_present"`
// This field is from variant [BrowserCdpCommandEventDataPagePrintToPdf].
Landscape bool `json:"landscape"`
// This field is from variant [BrowserCdpCommandEventDataPagePrintToPdf].
MarginBottom float64 `json:"margin_bottom"`
// This field is from variant [BrowserCdpCommandEventDataPagePrintToPdf].
MarginLeft float64 `json:"margin_left"`
// This field is from variant [BrowserCdpCommandEventDataPagePrintToPdf].
MarginRight float64 `json:"margin_right"`
// This field is from variant [BrowserCdpCommandEventDataPagePrintToPdf].
MarginTop float64 `json:"margin_top"`
// This field is from variant [BrowserCdpCommandEventDataPagePrintToPdf].
PageRangesPresent bool `json:"page_ranges_present"`
// This field is from variant [BrowserCdpCommandEventDataPagePrintToPdf].
PaperHeight float64 `json:"paper_height"`
// This field is from variant [BrowserCdpCommandEventDataPagePrintToPdf].
PaperWidth float64 `json:"paper_width"`
// This field is from variant [BrowserCdpCommandEventDataPagePrintToPdf].
PreferCssPageSize bool `json:"prefer_css_page_size"`
// This field is from variant [BrowserCdpCommandEventDataPagePrintToPdf].
PrintBackground bool `json:"print_background"`
// This field is from variant [BrowserCdpCommandEventDataPagePrintToPdf].
Scale float64 `json:"scale"`
// This field is from variant [BrowserCdpCommandEventDataPagePrintToPdf].
TransferMode string `json:"transfer_mode"`
// This field is from variant [BrowserCdpCommandEventDataPageStartScreencast].
EveryNthFrame int64 `json:"every_nth_frame"`
// This field is from variant [BrowserCdpCommandEventDataPageStartScreencast].
MaxHeight int64 `json:"max_height"`
// This field is from variant [BrowserCdpCommandEventDataPageStartScreencast].
MaxWidth int64 `json:"max_width"`
// This field is from variant [BrowserCdpCommandEventDataPageSetWebLifecycleState].
State string `json:"state"`
TargetID string `json:"target_id"`
// This field is from variant [BrowserCdpCommandEventDataTargetCreateTarget].
Background bool `json:"background"`
BrowserContextID string `json:"browser_context_id"`
// This field is from variant [BrowserCdpCommandEventDataTargetCreateTarget].
EnableBeginFrameControl bool `json:"enable_begin_frame_control"`
// This field is from variant [BrowserCdpCommandEventDataTargetCreateTarget].
Focus bool `json:"focus"`
// This field is from variant [BrowserCdpCommandEventDataTargetCreateTarget].
ForTab bool `json:"for_tab"`
Height int64 `json:"height"`
// This field is from variant [BrowserCdpCommandEventDataTargetCreateTarget].
Hidden bool `json:"hidden"`
Left int64 `json:"left"`
// This field is from variant [BrowserCdpCommandEventDataTargetCreateTarget].
NewWindow bool `json:"new_window"`
Top int64 `json:"top"`
Width int64 `json:"width"`
WindowState string `json:"window_state"`
// This field is from variant
// [BrowserCdpCommandEventDataTargetCreateBrowserContext].
DisposeOnDetach bool `json:"dispose_on_detach"`
// This field is from variant
// [BrowserCdpCommandEventDataTargetCreateBrowserContext].
ProxyBypassListPresent bool `json:"proxy_bypass_list_present"`
// This field is from variant
// [BrowserCdpCommandEventDataTargetCreateBrowserContext].
ProxyServerPresent bool `json:"proxy_server_present"`
// This field is from variant
// [BrowserCdpCommandEventDataTargetCreateBrowserContext].
UniversalNetworkAccessOriginCount int64 `json:"universal_network_access_origin_count"`
// This field is from variant [BrowserCdpCommandEventDataTargetOpenDevTools].
PanelID string `json:"panel_id"`
// This field is from variant [BrowserCdpCommandEventDataBrowserCancelDownload].
DownloadGuid string `json:"download_guid"`
WindowID int64 `json:"window_id"`
// This field is from variant [BrowserCdpCommandEventDataAutofillTrigger].
FieldID int64 `json:"field_id"`
// This field is from variant [BrowserCdpCommandEventDataAutofillTrigger].
AddressFieldCount int64 `json:"address_field_count"`
// This field is from variant [BrowserCdpCommandEventDataAutofillTrigger].
Mode string `json:"mode"`
JSON struct {
EventType respjson.Field
Method respjson.Field
Button respjson.Field
Buttons respjson.Field
ClickCount respjson.Field
CommandID respjson.Field
ConnectionID respjson.Field
DeltaX respjson.Field
DeltaY respjson.Field
Force respjson.Field
Modifiers respjson.Field
PointerType respjson.Field
SessionID respjson.Field
TangentialPressure respjson.Field
TiltX respjson.Field
TiltY respjson.Field
Twist respjson.Field
X respjson.Field
Y respjson.Field
AutoRepeat respjson.Field
CommandCount respjson.Field
IsKeypad respjson.Field
IsSystemKey respjson.Field
Location respjson.Field
NamedKey respjson.Field
TextLength respjson.Field
ReplacementEnd respjson.Field
ReplacementStart respjson.Field
SelectionEnd respjson.Field
SelectionStart respjson.Field
TouchPointCount respjson.Field
RadiusX respjson.Field
RadiusY respjson.Field
RotationAngle respjson.Field
DragFileCount respjson.Field
DragItemCount respjson.Field
DragMimeCategories respjson.Field
DragOperationsMask respjson.Field
GestureSourceType respjson.Field
RelativeSpeed respjson.Field
ScaleFactor respjson.Field
PreventFling respjson.Field
RepeatCount respjson.Field
RepeatDelayMs respjson.Field
Speed respjson.Field
XDistance respjson.Field
XOverscroll respjson.Field
YDistance respjson.Field
YOverscroll respjson.Field
Duration respjson.Field
TapCount respjson.Field
FileCount respjson.Field
BackendNodeID respjson.Field
NodeID respjson.Field
ObjectID respjson.Field
RectHeight respjson.Field
RectWidth respjson.Field
RectX respjson.Field
RectY respjson.Field
CaptureBeyondViewport respjson.Field
ClipHeight respjson.Field
ClipScale respjson.Field
ClipWidth respjson.Field
ClipX respjson.Field
ClipY respjson.Field
Format respjson.Field
FromSurface respjson.Field
OptimizeForSpeed respjson.Field
Quality respjson.Field
Accept respjson.Field
PromptTextLength respjson.Field
FrameID respjson.Field
ReferrerPolicy respjson.Field
ReferrerPresent respjson.Field
TransitionType respjson.Field
URLScheme respjson.Field
EntryID respjson.Field
IgnoreCache respjson.Field
LoaderID respjson.Field
ScriptLength respjson.Field
DisplayHeaderFooter respjson.Field
FooterTemplatePresent respjson.Field
GenerateDocumentOutline respjson.Field
GenerateTaggedPdf respjson.Field
HeaderTemplatePresent respjson.Field
Landscape respjson.Field
MarginBottom respjson.Field
MarginLeft respjson.Field
MarginRight respjson.Field
MarginTop respjson.Field
PageRangesPresent respjson.Field
PaperHeight respjson.Field
PaperWidth respjson.Field
PreferCssPageSize respjson.Field
PrintBackground respjson.Field
Scale respjson.Field
TransferMode respjson.Field
EveryNthFrame respjson.Field
MaxHeight respjson.Field
MaxWidth respjson.Field
State respjson.Field
TargetID respjson.Field
Background respjson.Field
BrowserContextID respjson.Field
EnableBeginFrameControl respjson.Field
Focus respjson.Field
ForTab respjson.Field
Height respjson.Field
Hidden respjson.Field
Left respjson.Field
NewWindow respjson.Field
Top respjson.Field
Width respjson.Field
WindowState respjson.Field
DisposeOnDetach respjson.Field
ProxyBypassListPresent respjson.Field
ProxyServerPresent respjson.Field
UniversalNetworkAccessOriginCount respjson.Field
PanelID respjson.Field
DownloadGuid respjson.Field
WindowID respjson.Field
FieldID respjson.Field
AddressFieldCount respjson.Field
Mode respjson.Field
raw string
} `json:"-"`
}
// anyBrowserCdpCommandEventData is implemented by each variant of
// [BrowserCdpCommandEventDataUnion] to add type safety for the return type of
// [BrowserCdpCommandEventDataUnion.AsAny]
type anyBrowserCdpCommandEventData interface {
implBrowserCdpCommandEventDataUnion()
}
func (BrowserCdpCommandEventDataInputDispatchMouseEvent) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataInputDispatchKeyEvent) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataInputInsertText) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataInputImeSetComposition) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataInputDispatchTouchEvent) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataInputDispatchDragEvent) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataInputCancelDragging) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataInputEmulateTouchFromMouseEvent) implBrowserCdpCommandEventDataUnion() {
}
func (BrowserCdpCommandEventDataInputSynthesizePinchGesture) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataInputSynthesizeScrollGesture) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataInputSynthesizeTapGesture) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataDomSetFileInputFiles) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataDomFocus) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataDomScrollIntoViewIfNeeded) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataPageBringToFront) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataPageCaptureScreenshot) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataPageCaptureSnapshot) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataPageHandleJavaScriptDialog) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataPageNavigate) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataPageNavigateToHistoryEntry) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataPageReload) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataPagePrintToPdf) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataPageStartScreencast) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataPageStopScreencast) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataPageStopLoading) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataPageClose) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataPageSetWebLifecycleState) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataTargetActivateTarget) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataTargetCloseTarget) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataTargetCreateTarget) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataTargetCreateBrowserContext) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataTargetDisposeBrowserContext) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataTargetOpenDevTools) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataBrowserCancelDownload) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataBrowserClose) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataBrowserSetWindowBounds) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataBrowserSetContentsSize) implBrowserCdpCommandEventDataUnion() {}
func (BrowserCdpCommandEventDataAutofillTrigger) implBrowserCdpCommandEventDataUnion() {}
// Use the following switch statement to find the correct variant
//
// switch variant := BrowserCdpCommandEventDataUnion.AsAny().(type) {
// case kernel.BrowserCdpCommandEventDataInputDispatchMouseEvent:
// case kernel.BrowserCdpCommandEventDataInputDispatchKeyEvent:
// case kernel.BrowserCdpCommandEventDataInputInsertText:
// case kernel.BrowserCdpCommandEventDataInputImeSetComposition:
// case kernel.BrowserCdpCommandEventDataInputDispatchTouchEvent:
// case kernel.BrowserCdpCommandEventDataInputDispatchDragEvent:
// case kernel.BrowserCdpCommandEventDataInputCancelDragging:
// case kernel.BrowserCdpCommandEventDataInputEmulateTouchFromMouseEvent:
// case kernel.BrowserCdpCommandEventDataInputSynthesizePinchGesture:
// case kernel.BrowserCdpCommandEventDataInputSynthesizeScrollGesture:
// case kernel.BrowserCdpCommandEventDataInputSynthesizeTapGesture:
// case kernel.BrowserCdpCommandEventDataDomSetFileInputFiles:
// case kernel.BrowserCdpCommandEventDataDomFocus:
// case kernel.BrowserCdpCommandEventDataDomScrollIntoViewIfNeeded:
// case kernel.BrowserCdpCommandEventDataPageBringToFront:
// case kernel.BrowserCdpCommandEventDataPageCaptureScreenshot:
// case kernel.BrowserCdpCommandEventDataPageCaptureSnapshot:
// case kernel.BrowserCdpCommandEventDataPageHandleJavaScriptDialog:
// case kernel.BrowserCdpCommandEventDataPageNavigate:
// case kernel.BrowserCdpCommandEventDataPageNavigateToHistoryEntry:
// case kernel.BrowserCdpCommandEventDataPageReload:
// case kernel.BrowserCdpCommandEventDataPagePrintToPdf:
// case kernel.BrowserCdpCommandEventDataPageStartScreencast:
// case kernel.BrowserCdpCommandEventDataPageStopScreencast:
// case kernel.BrowserCdpCommandEventDataPageStopLoading:
// case kernel.BrowserCdpCommandEventDataPageClose:
// case kernel.BrowserCdpCommandEventDataPageSetWebLifecycleState:
// case kernel.BrowserCdpCommandEventDataTargetActivateTarget:
// case kernel.BrowserCdpCommandEventDataTargetCloseTarget:
// case kernel.BrowserCdpCommandEventDataTargetCreateTarget:
// case kernel.BrowserCdpCommandEventDataTargetCreateBrowserContext:
// case kernel.BrowserCdpCommandEventDataTargetDisposeBrowserContext:
// case kernel.BrowserCdpCommandEventDataTargetOpenDevTools:
// case kernel.BrowserCdpCommandEventDataBrowserCancelDownload:
// case kernel.BrowserCdpCommandEventDataBrowserClose:
// case kernel.BrowserCdpCommandEventDataBrowserSetWindowBounds:
// case kernel.BrowserCdpCommandEventDataBrowserSetContentsSize:
// case kernel.BrowserCdpCommandEventDataAutofillTrigger:
// default:
// fmt.Errorf("no variant present")
// }
func (u BrowserCdpCommandEventDataUnion) AsAny() anyBrowserCdpCommandEventData {
switch u.Method {
case "Input.dispatchMouseEvent":
return u.AsInputDispatchMouseEvent()
case "Input.dispatchKeyEvent":
return u.AsInputDispatchKeyEvent()
case "Input.insertText":
return u.AsInputInsertText()
case "Input.imeSetComposition":
return u.AsInputImeSetComposition()
case "Input.dispatchTouchEvent":
return u.AsInputDispatchTouchEvent()
case "Input.dispatchDragEvent":
return u.AsInputDispatchDragEvent()
case "Input.cancelDragging":
return u.AsInputCancelDragging()
case "Input.emulateTouchFromMouseEvent":
return u.AsInputEmulateTouchFromMouseEvent()
case "Input.synthesizePinchGesture":
return u.AsInputSynthesizePinchGesture()
case "Input.synthesizeScrollGesture":
return u.AsInputSynthesizeScrollGesture()
case "Input.synthesizeTapGesture":
return u.AsInputSynthesizeTapGesture()
case "DOM.setFileInputFiles":
return u.AsDomSetFileInputFiles()
case "DOM.focus":
return u.AsDomFocus()
case "DOM.scrollIntoViewIfNeeded":
return u.AsDomScrollIntoViewIfNeeded()
case "Page.bringToFront":
return u.AsPageBringToFront()
case "Page.captureScreenshot":
return u.AsPageCaptureScreenshot()
case "Page.captureSnapshot":
return u.AsPageCaptureSnapshot()
case "Page.handleJavaScriptDialog":
return u.AsPageHandleJavaScriptDialog()
case "Page.navigate":
return u.AsPageNavigate()
case "Page.navigateToHistoryEntry":
return u.AsPageNavigateToHistoryEntry()
case "Page.reload":
return u.AsPageReload()
case "Page.printToPDF":
return u.AsPagePrintToPdf()
case "Page.startScreencast":
return u.AsPageStartScreencast()
case "Page.stopScreencast":
return u.AsPageStopScreencast()
case "Page.stopLoading":
return u.AsPageStopLoading()
case "Page.close":
return u.AsPageClose()
case "Page.setWebLifecycleState":
return u.AsPageSetWebLifecycleState()
case "Target.activateTarget":
return u.AsTargetActivateTarget()
case "Target.closeTarget":
return u.AsTargetCloseTarget()
case "Target.createTarget":
return u.AsTargetCreateTarget()
case "Target.createBrowserContext":
return u.AsTargetCreateBrowserContext()
case "Target.disposeBrowserContext":
return u.AsTargetDisposeBrowserContext()
case "Target.openDevTools":
return u.AsTargetOpenDevTools()
case "Browser.cancelDownload":
return u.AsBrowserCancelDownload()
case "Browser.close":
return u.AsBrowserClose()
case "Browser.setWindowBounds":
return u.AsBrowserSetWindowBounds()
case "Browser.setContentsSize":
return u.AsBrowserSetContentsSize()
case "Autofill.trigger":
return u.AsAutofillTrigger()
}
return nil
}
func (u BrowserCdpCommandEventDataUnion) AsInputDispatchMouseEvent() (v BrowserCdpCommandEventDataInputDispatchMouseEvent) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
func (u BrowserCdpCommandEventDataUnion) AsInputDispatchKeyEvent() (v BrowserCdpCommandEventDataInputDispatchKeyEvent) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
func (u BrowserCdpCommandEventDataUnion) AsInputInsertText() (v BrowserCdpCommandEventDataInputInsertText) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
func (u BrowserCdpCommandEventDataUnion) AsInputImeSetComposition() (v BrowserCdpCommandEventDataInputImeSetComposition) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
func (u BrowserCdpCommandEventDataUnion) AsInputDispatchTouchEvent() (v BrowserCdpCommandEventDataInputDispatchTouchEvent) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
func (u BrowserCdpCommandEventDataUnion) AsInputDispatchDragEvent() (v BrowserCdpCommandEventDataInputDispatchDragEvent) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
func (u BrowserCdpCommandEventDataUnion) AsInputCancelDragging() (v BrowserCdpCommandEventDataInputCancelDragging) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
func (u BrowserCdpCommandEventDataUnion) AsInputEmulateTouchFromMouseEvent() (v BrowserCdpCommandEventDataInputEmulateTouchFromMouseEvent) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
func (u BrowserCdpCommandEventDataUnion) AsInputSynthesizePinchGesture() (v BrowserCdpCommandEventDataInputSynthesizePinchGesture) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
func (u BrowserCdpCommandEventDataUnion) AsInputSynthesizeScrollGesture() (v BrowserCdpCommandEventDataInputSynthesizeScrollGesture) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
func (u BrowserCdpCommandEventDataUnion) AsInputSynthesizeTapGesture() (v BrowserCdpCommandEventDataInputSynthesizeTapGesture) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
func (u BrowserCdpCommandEventDataUnion) AsDomSetFileInputFiles() (v BrowserCdpCommandEventDataDomSetFileInputFiles) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}