browser_commander/puppeteer/api/
browser_launcher.rs1#![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 BrowserLauncher
15);
16
17impl BrowserLauncher {
18 pub async fn browser(&self) -> Result<String, BridgeError> {
24 self.remote.get("browser").await
25 }
26
27 pub async fn launch(&self, options: Option<Value>) -> Result<Browser, BridgeError> {
33 self.remote.call("launch", vec![options]).await
34 }
35
36 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 pub async fn default_args(&self, object: Value) -> Result<Vec<String>, BridgeError> {
51 self.remote.call("defaultArgs", vec![Some(object)]).await
52 }
53}