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
// @generated by scripts/generate-puppeteer-bindings.mjs from
// rust/protocol/puppeteer/api.json. Do not edit by hand.
#![allow(clippy::all, missing_docs, unused_imports, non_snake_case)]
use serde_json::Value;
use super::*;
use crate::puppeteer::bridge::{binary, remote_type, BridgeError, JsFunction, Remote};
remote_type!(
/// Puppeteer's `Mouse` (puppeteer-core 25.10.0), a remote object
/// served by `browser-commander serve --stdio`.
Mouse
);
impl Mouse {
/// `Mouse.reset`
///
/// ```text
/// reset(): Promise<void>
/// ```
pub async fn reset(&self) -> Result<(), BridgeError> {
self.remote.call("reset", vec![]).await
}
/// `Mouse.move`
///
/// ```text
/// move(x: number, y: number, options?: Readonly<MouseMoveOptions>): Promise<void>
/// ```
pub async fn r#move(&self, x: f64, y: f64, options: Option<Value>) -> Result<(), BridgeError> {
self.remote.call("move", vec![Some(Value::from(x)), Some(Value::from(y)), options]).await
}
/// `Mouse.down`
///
/// ```text
/// down(options?: Readonly<MouseOptions>): Promise<void>
/// ```
pub async fn down(&self, options: Option<Value>) -> Result<(), BridgeError> {
self.remote.call("down", vec![options]).await
}
/// `Mouse.up`
///
/// ```text
/// up(options?: Readonly<MouseOptions>): Promise<void>
/// ```
pub async fn up(&self, options: Option<Value>) -> Result<(), BridgeError> {
self.remote.call("up", vec![options]).await
}
/// `Mouse.click`
///
/// ```text
/// click(x: number, y: number, options?: Readonly<MouseClickOptions>): Promise<void>
/// ```
pub async fn click(&self, x: f64, y: f64, options: Option<Value>) -> Result<(), BridgeError> {
self.remote.call("click", vec![Some(Value::from(x)), Some(Value::from(y)), options]).await
}
/// `Mouse.wheel`
///
/// ```text
/// wheel(options?: Readonly<MouseWheelOptions>): Promise<void>
/// ```
pub async fn wheel(&self, options: Option<Value>) -> Result<(), BridgeError> {
self.remote.call("wheel", vec![options]).await
}
/// `Mouse.drag`
///
/// ```text
/// drag(start: Point, target: Point): Promise<Protocol.Input.DragData>
/// ```
pub async fn drag(&self, start: Value, target: Value) -> Result<Value, BridgeError> {
self.remote.call("drag", vec![Some(start), Some(target)]).await
}
/// `Mouse.dragEnter`
///
/// ```text
/// dragEnter(target: Point, data: Protocol.Input.DragData): Promise<void>
/// ```
pub async fn drag_enter(&self, target: Value, data: Value) -> Result<(), BridgeError> {
self.remote.call("dragEnter", vec![Some(target), Some(data)]).await
}
/// `Mouse.dragOver`
///
/// ```text
/// dragOver(target: Point, data: Protocol.Input.DragData): Promise<void>
/// ```
pub async fn drag_over(&self, target: Value, data: Value) -> Result<(), BridgeError> {
self.remote.call("dragOver", vec![Some(target), Some(data)]).await
}
/// `Mouse.drop`
///
/// ```text
/// drop(target: Point, data: Protocol.Input.DragData): Promise<void>
/// ```
pub async fn drop(&self, target: Value, data: Value) -> Result<(), BridgeError> {
self.remote.call("drop", vec![Some(target), Some(data)]).await
}
/// `Mouse.dragAndDrop`
///
/// ```text
/// dragAndDrop(start: Point, target: Point, options?: { delay?: number; }): Promise<void>
/// ```
pub async fn drag_and_drop(&self, start: Value, target: Value, options: Option<Value>) -> Result<(), BridgeError> {
self.remote.call("dragAndDrop", vec![Some(start), Some(target), options]).await
}
}