Skip to main content

browser_commander/puppeteer/api/
browser_launcher.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 `BrowserLauncher` (puppeteer-core 25.10.0), a remote object
13    /// served by `browser-commander serve --stdio`.
14    BrowserLauncher
15);
16
17impl BrowserLauncher {
18    /// `BrowserLauncher.browser`
19    ///
20    /// ```text
21    /// get browser(): SupportedBrowser
22    /// ```
23    pub async fn browser(&self) -> Result<String, BridgeError> {
24        self.remote.get("browser").await
25    }
26
27    /// `BrowserLauncher.launch`
28    ///
29    /// ```text
30    /// launch(options?: LaunchOptions): Promise<Browser>
31    /// ```
32    pub async fn launch(&self, options: Option<Value>) -> Result<Browser, BridgeError> {
33        self.remote.call("launch", vec![options]).await
34    }
35
36    /// `BrowserLauncher.executablePath`
37    ///
38    /// ```text
39    /// executablePath(channel?: ChromeReleaseChannel, validatePath?: boolean): Promise<string>
40    /// ```
41    pub async fn executable_path(&self, channel: Option<&str>, validate_path: Option<bool>) -> Result<String, BridgeError> {
42        self.remote.call("executablePath", vec![channel.map(|x| Value::from(x)), validate_path.map(|x| Value::from(x))]).await
43    }
44
45    /// `BrowserLauncher.defaultArgs`
46    ///
47    /// ```text
48    /// defaultArgs(object: LaunchOptions): string[]
49    /// ```
50    pub async fn default_args(&self, object: Value) -> Result<Vec<String>, BridgeError> {
51        self.remote.call("defaultArgs", vec![Some(object)]).await
52    }
53}