browser-commander 0.18.0

Universal browser automation library that supports multiple browser engines with a unified API
Documentation
// @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 `Touchscreen` (puppeteer-core 25.10.0), a remote object
    /// served by `browser-commander serve --stdio`.
    Touchscreen
);

impl Touchscreen {
    /// `Touchscreen.tap`
    ///
    /// ```text
    /// tap(x: number, y: number): Promise<void>
    /// ```
    pub async fn tap(&self, x: f64, y: f64) -> Result<(), BridgeError> {
        self.remote.call("tap", vec![Some(Value::from(x)), Some(Value::from(y))]).await
    }

    /// `Touchscreen.touchStart`
    ///
    /// ```text
    /// touchStart(x: number, y: number): Promise<TouchHandle>
    /// ```
    pub async fn touch_start(&self, x: f64, y: f64) -> Result<TouchHandle, BridgeError> {
        self.remote.call("touchStart", vec![Some(Value::from(x)), Some(Value::from(y))]).await
    }

    /// `Touchscreen.touchMove`
    ///
    /// ```text
    /// touchMove(x: number, y: number): Promise<void>
    /// ```
    pub async fn touch_move(&self, x: f64, y: f64) -> Result<(), BridgeError> {
        self.remote.call("touchMove", vec![Some(Value::from(x)), Some(Value::from(y))]).await
    }

    /// `Touchscreen.touchEnd`
    ///
    /// ```text
    /// touchEnd(): Promise<void>
    /// ```
    pub async fn touch_end(&self) -> Result<(), BridgeError> {
        self.remote.call("touchEnd", vec![]).await
    }
}