browser-protocol 0.1.1

Generated Rust types and commands for the Chrome DevTools Protocol (browser-protocol)
Documentation
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
use serde::{Serialize, Deserialize};


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct TouchPoint {
    /// X coordinate of the event relative to the main frame's viewport in CSS pixels.

    pub x: f64,
    /// Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to
    /// the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.

    pub y: f64,
    /// X radius of the touch area (default: 1.0).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub radiusX: Option<f64>,
    /// Y radius of the touch area (default: 1.0).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub radiusY: Option<f64>,
    /// Rotation angle (default: 0.0).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub rotationAngle: Option<f64>,
    /// Force (default: 1.0).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub force: Option<f64>,
    /// The normalized tangential pressure, which has a range of \[-1,1\] (default: 0).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub tangentialPressure: Option<f64>,
    /// The plane angle between the Y-Z plane and the plane containing both the stylus axis and the Y axis, in degrees of the range \[-90,90\], a positive tiltX is to the right (default: 0)

    #[serde(skip_serializing_if = "Option::is_none")]
    pub tiltX: Option<f64>,
    /// The plane angle between the X-Z plane and the plane containing both the stylus axis and the X axis, in degrees of the range \[-90,90\], a positive tiltY is towards the user (default: 0).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub tiltY: Option<f64>,
    /// The clockwise rotation of a pen stylus around its own major axis, in degrees in the range \[0,359\] (default: 0).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub twist: Option<i64>,
    /// Identifier used to track touch sources between events, must be unique within an event.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub id: Option<f64>,
}


#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
pub enum GestureSourceType {
    #[default]
    Default,
    Touch,
    Mouse,
}


#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
pub enum MouseButton {
    #[default]
    None,
    Left,
    Middle,
    Right,
    Back,
    Forward,
}

/// UTC time in seconds, counted from January 1, 1970.

pub type TimeSinceEpoch = f64;


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct DragDataItem {
    /// Mime type of the dragged data.

    pub mimeType: String,
    /// Depending of the value of 'mimeType', it contains the dragged link,
    /// text, HTML markup or any other data.

    pub data: String,
    /// Title associated with a link. Only valid when 'mimeType' == "text/uri-list".

    #[serde(skip_serializing_if = "Option::is_none")]
    pub title: Option<String>,
    /// Stores the base URL for the contained markup. Only valid when 'mimeType'
    /// == "text/html".

    #[serde(skip_serializing_if = "Option::is_none")]
    pub baseURL: Option<String>,
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct DragData {

    pub items: Vec<DragDataItem>,
    /// List of filenames that should be included when dropping

    #[serde(skip_serializing_if = "Option::is_none")]
    pub files: Option<Vec<String>>,
    /// Bit field representing allowed drag operations. Copy = 1, Link = 2, Move = 16

    pub dragOperationsMask: i64,
}

/// Dispatches a drag event into the page.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct DispatchDragEventParams {
    /// Type of the drag event.

    #[serde(rename = "type")]
    pub type_: String,
    /// X coordinate of the event relative to the main frame's viewport in CSS pixels.

    pub x: f64,
    /// Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to
    /// the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.

    pub y: f64,

    pub data: DragData,
    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
    /// (default: 0).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub modifiers: Option<i64>,
}

/// Dispatches a key event to the page.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct DispatchKeyEventParams {
    /// Type of the key event.

    #[serde(rename = "type")]
    pub type_: String,
    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
    /// (default: 0).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub modifiers: Option<i64>,
    /// Time at which the event occurred.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub timestamp: Option<TimeSinceEpoch>,
    /// Text as generated by processing a virtual key code with a keyboard layout. Not needed for
    /// for 'keyUp' and 'rawKeyDown' events (default: "")

    #[serde(skip_serializing_if = "Option::is_none")]
    pub text: Option<String>,
    /// Text that would have been generated by the keyboard if no modifiers were pressed (except for
    /// shift). Useful for shortcut (accelerator) key handling (default: "").

    #[serde(skip_serializing_if = "Option::is_none")]
    pub unmodifiedText: Option<String>,
    /// Unique key identifier (e.g., 'U+0041') (default: "").

    #[serde(skip_serializing_if = "Option::is_none")]
    pub keyIdentifier: Option<String>,
    /// Unique DOM defined string value for each physical key (e.g., 'KeyA') (default: "").

    #[serde(skip_serializing_if = "Option::is_none")]
    pub code: Option<String>,
    /// Unique DOM defined string value describing the meaning of the key in the context of active
    /// modifiers, keyboard layout, etc (e.g., 'AltGr') (default: "").

    #[serde(skip_serializing_if = "Option::is_none")]
    pub key: Option<String>,
    /// Windows virtual key code (default: 0).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub windowsVirtualKeyCode: Option<i64>,
    /// Native virtual key code (default: 0).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub nativeVirtualKeyCode: Option<i64>,
    /// Whether the event was generated from auto repeat (default: false).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub autoRepeat: Option<bool>,
    /// Whether the event was generated from the keypad (default: false).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub isKeypad: Option<bool>,
    /// Whether the event was a system key event (default: false).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub isSystemKey: Option<bool>,
    /// Whether the event was from the left or right side of the keyboard. 1=Left, 2=Right (default:
    /// 0).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub location: Option<i64>,
    /// Editing commands to send with the key event (e.g., 'selectAll') (default: \[\]).
    /// These are related to but not equal the command names used in 'document.execCommand' and NSStandardKeyBindingResponding.
    /// See <https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/editing/commands/editor_command_names.h> for valid command names.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub commands: Option<Vec<String>>,
}

/// This method emulates inserting text that doesn't come from a key press,
/// for example an emoji keyboard or an IME.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct InsertTextParams {
    /// The text to insert.

    pub text: String,
}

/// This method sets the current candidate text for IME.
/// Use imeCommitComposition to commit the final text.
/// Use imeSetComposition with empty string as text to cancel composition.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ImeSetCompositionParams {
    /// The text to insert

    pub text: String,
    /// selection start

    pub selectionStart: i64,
    /// selection end

    pub selectionEnd: i64,
    /// replacement start

    #[serde(skip_serializing_if = "Option::is_none")]
    pub replacementStart: Option<i64>,
    /// replacement end

    #[serde(skip_serializing_if = "Option::is_none")]
    pub replacementEnd: Option<i64>,
}

/// Dispatches a mouse event to the page.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct DispatchMouseEventParams {
    /// Type of the mouse event.

    #[serde(rename = "type")]
    pub type_: String,
    /// X coordinate of the event relative to the main frame's viewport in CSS pixels.

    pub x: f64,
    /// Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to
    /// the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.

    pub y: f64,
    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
    /// (default: 0).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub modifiers: Option<i64>,
    /// Time at which the event occurred.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub timestamp: Option<TimeSinceEpoch>,
    /// Mouse button (default: "none").

    #[serde(skip_serializing_if = "Option::is_none")]
    pub button: Option<MouseButton>,
    /// A number indicating which buttons are pressed on the mouse when a mouse event is triggered.
    /// Left=1, Right=2, Middle=4, Back=8, Forward=16, None=0.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub buttons: Option<i64>,
    /// Number of times the mouse button was clicked (default: 0).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub clickCount: Option<u64>,
    /// The normalized pressure, which has a range of \[0,1\] (default: 0).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub force: Option<f64>,
    /// The normalized tangential pressure, which has a range of \[-1,1\] (default: 0).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub tangentialPressure: Option<f64>,
    /// The plane angle between the Y-Z plane and the plane containing both the stylus axis and the Y axis, in degrees of the range \[-90,90\], a positive tiltX is to the right (default: 0).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub tiltX: Option<f64>,
    /// The plane angle between the X-Z plane and the plane containing both the stylus axis and the X axis, in degrees of the range \[-90,90\], a positive tiltY is towards the user (default: 0).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub tiltY: Option<f64>,
    /// The clockwise rotation of a pen stylus around its own major axis, in degrees in the range \[0,359\] (default: 0).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub twist: Option<i64>,
    /// X delta in CSS pixels for mouse wheel event (default: 0).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub deltaX: Option<f64>,
    /// Y delta in CSS pixels for mouse wheel event (default: 0).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub deltaY: Option<f64>,
    /// Pointer type (default: "mouse").

    #[serde(skip_serializing_if = "Option::is_none")]
    pub pointerType: Option<String>,
}

/// Dispatches a touch event to the page.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct DispatchTouchEventParams {
    /// Type of the touch event. TouchEnd and TouchCancel must not contain any touch points, while
    /// TouchStart and TouchMove must contains at least one.

    #[serde(rename = "type")]
    pub type_: String,
    /// Active touch points on the touch device. One event per any changed point (compared to
    /// previous touch event in a sequence) is generated, emulating pressing/moving/releasing points
    /// one by one.

    pub touchPoints: Vec<TouchPoint>,
    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
    /// (default: 0).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub modifiers: Option<i64>,
    /// Time at which the event occurred.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub timestamp: Option<TimeSinceEpoch>,
}

/// Emulates touch event from the mouse event parameters.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct EmulateTouchFromMouseEventParams {
    /// Type of the mouse event.

    #[serde(rename = "type")]
    pub type_: String,
    /// X coordinate of the mouse pointer in DIP.

    pub x: i32,
    /// Y coordinate of the mouse pointer in DIP.

    pub y: i32,
    /// Mouse button. Only "none", "left", "right" are supported.

    pub button: MouseButton,
    /// Time at which the event occurred (default: current time).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub timestamp: Option<TimeSinceEpoch>,
    /// X delta in DIP for mouse wheel event (default: 0).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub deltaX: Option<f64>,
    /// Y delta in DIP for mouse wheel event (default: 0).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub deltaY: Option<f64>,
    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
    /// (default: 0).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub modifiers: Option<i64>,
    /// Number of times the mouse button was clicked (default: 0).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub clickCount: Option<u64>,
}

/// Ignores input events (useful while auditing page).

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SetIgnoreInputEventsParams {
    /// Ignores input events processing when set to true.

    pub ignore: bool,
}

/// Prevents default drag and drop behavior and instead emits 'Input.dragIntercepted' events.
/// Drag and drop behavior can be directly controlled via 'Input.dispatchDragEvent'.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SetInterceptDragsParams {

    pub enabled: bool,
}

/// Synthesizes a pinch gesture over a time period by issuing appropriate touch events.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SynthesizePinchGestureParams {
    /// X coordinate of the start of the gesture in CSS pixels.

    pub x: f64,
    /// Y coordinate of the start of the gesture in CSS pixels.

    pub y: f64,
    /// Relative scale factor after zooming (\>1.0 zooms in, \<1.0 zooms out).

    pub scaleFactor: f64,
    /// Relative pointer speed in pixels per second (default: 800).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub relativeSpeed: Option<i64>,
    /// Which type of input events to be generated (default: 'default', which queries the platform
    /// for the preferred input type).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub gestureSourceType: Option<GestureSourceType>,
}

/// Synthesizes a scroll gesture over a time period by issuing appropriate touch events.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SynthesizeScrollGestureParams {
    /// X coordinate of the start of the gesture in CSS pixels.

    pub x: f64,
    /// Y coordinate of the start of the gesture in CSS pixels.

    pub y: f64,
    /// The distance to scroll along the X axis (positive to scroll left).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub xDistance: Option<f64>,
    /// The distance to scroll along the Y axis (positive to scroll up).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub yDistance: Option<f64>,
    /// The number of additional pixels to scroll back along the X axis, in addition to the given
    /// distance.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub xOverscroll: Option<f64>,
    /// The number of additional pixels to scroll back along the Y axis, in addition to the given
    /// distance.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub yOverscroll: Option<f64>,
    /// Prevent fling (default: true).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub preventFling: Option<bool>,
    /// Swipe speed in pixels per second (default: 800).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub speed: Option<i64>,
    /// Which type of input events to be generated (default: 'default', which queries the platform
    /// for the preferred input type).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub gestureSourceType: Option<GestureSourceType>,
    /// The number of times to repeat the gesture (default: 0).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub repeatCount: Option<u64>,
    /// The number of milliseconds delay between each repeat. (default: 250).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub repeatDelayMs: Option<i64>,
    /// The name of the interaction markers to generate, if not empty (default: "").

    #[serde(skip_serializing_if = "Option::is_none")]
    pub interactionMarkerName: Option<String>,
}

/// Synthesizes a tap gesture over a time period by issuing appropriate touch events.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SynthesizeTapGestureParams {
    /// X coordinate of the start of the gesture in CSS pixels.

    pub x: f64,
    /// Y coordinate of the start of the gesture in CSS pixels.

    pub y: f64,
    /// Duration between touchdown and touchup events in ms (default: 50).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub duration: Option<i64>,
    /// Number of times to perform the tap (e.g. 2 for double tap, default: 1).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub tapCount: Option<u64>,
    /// Which type of input events to be generated (default: 'default', which queries the platform
    /// for the preferred input type).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub gestureSourceType: Option<GestureSourceType>,
}