Skip to main content

browser_commander/puppeteer/api/
touchscreen.rs

1// @generated by scripts/generate-puppeteer-bindings.mjs from
2// rust/protocol/puppeteer/api.json. Do not edit by hand.
3
4#![allow(clippy::all, missing_docs, unused_imports, non_snake_case)]
5
6use serde_json::Value;
7
8use super::*;
9use crate::puppeteer::bridge::{binary, remote_type, BridgeError, JsFunction, Remote};
10
11remote_type!(
12    /// Puppeteer's `Touchscreen` (puppeteer-core 25.12.0), a remote object
13    /// served by `browser-commander serve --stdio`.
14    Touchscreen
15);
16
17impl Touchscreen {
18    /// `Touchscreen.tap`
19    ///
20    /// ```text
21    /// tap(x: number, y: number): Promise<void>
22    /// ```
23    pub async fn tap(&self, x: f64, y: f64) -> Result<(), BridgeError> {
24        self.remote.call("tap", vec![Some(Value::from(x)), Some(Value::from(y))]).await
25    }
26
27    /// `Touchscreen.touchStart`
28    ///
29    /// ```text
30    /// touchStart(x: number, y: number): Promise<TouchHandle>
31    /// ```
32    pub async fn touch_start(&self, x: f64, y: f64) -> Result<TouchHandle, BridgeError> {
33        self.remote.call("touchStart", vec![Some(Value::from(x)), Some(Value::from(y))]).await
34    }
35
36    /// `Touchscreen.touchMove`
37    ///
38    /// ```text
39    /// touchMove(x: number, y: number): Promise<void>
40    /// ```
41    pub async fn touch_move(&self, x: f64, y: f64) -> Result<(), BridgeError> {
42        self.remote.call("touchMove", vec![Some(Value::from(x)), Some(Value::from(y))]).await
43    }
44
45    /// `Touchscreen.touchEnd`
46    ///
47    /// ```text
48    /// touchEnd(): Promise<void>
49    /// ```
50    pub async fn touch_end(&self) -> Result<(), BridgeError> {
51        self.remote.call("touchEnd", vec![]).await
52    }
53}