browser-commander 0.17.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};

impl Page {
    /// `Page.resize`
    ///
    /// ```text
    /// resize(params: { contentWidth: number; contentHeight: number; }): Promise<void>
    /// ```
    pub async fn resize(&self, params: Value) -> Result<(), BridgeError> {
        self.remote.call("resize", vec![Some(params)]).await
    }

    /// `Page.windowId`
    ///
    /// ```text
    /// windowId(): Promise<WindowId>
    /// ```
    pub async fn window_id(&self) -> Result<String, BridgeError> {
        self.remote.call("windowId", vec![]).await
    }

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

    /// `Page.hasDevTools`
    ///
    /// ```text
    /// hasDevTools(): Promise<boolean>
    /// ```
    pub async fn has_dev_tools(&self) -> Result<bool, BridgeError> {
        self.remote.call("hasDevTools", vec![]).await
    }

    /// `Page.bluetooth`
    ///
    /// ```text
    /// get bluetooth(): BluetoothEmulation
    /// ```
    pub async fn bluetooth(&self) -> Result<BluetoothEmulation, BridgeError> {
        self.remote.get("bluetooth").await
    }

    /// `Page.triggerExtensionAction`
    ///
    /// ```text
    /// triggerExtensionAction(extension: Extension): Promise<void>
    /// ```
    pub async fn trigger_extension_action(&self, extension: &Extension) -> Result<(), BridgeError> {
        self.remote.call("triggerExtensionAction", vec![Some(extension.remote().to_wire())]).await
    }

    /// `Page.extensionRealms`
    ///
    /// ```text
    /// extensionRealms(): Realm[]
    /// ```
    pub async fn extension_realms(&self) -> Result<Vec<Realm>, BridgeError> {
        self.remote.call("extensionRealms", vec![]).await
    }
}