1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// @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 `PuppeteerNode` (puppeteer-core 25.10.0), a remote object
/// served by `browser-commander serve --stdio`.
///
/// Extends [`Puppeteer`]; the inherited methods are repeated here.
PuppeteerNode
);
impl PuppeteerNode {
/// `PuppeteerNode.connect`
///
/// ```text
/// connect(options: ConnectOptions): Promise<Browser>
/// ```
pub async fn connect(&self, options: Value) -> Result<Browser, BridgeError> {
self.remote.call("connect", vec![Some(options)]).await
}
/// `PuppeteerNode.launch`
///
/// ```text
/// launch(options?: LaunchOptions): Promise<Browser>
/// ```
pub async fn launch(&self, options: Option<Value>) -> Result<Browser, BridgeError> {
self.remote.call("launch", vec![options]).await
}
/// `PuppeteerNode.executablePath`
///
/// ```text
/// executablePath(channel: ChromeReleaseChannel): Promise<string>
/// executablePath(options: LaunchOptions): Promise<string>
/// executablePath(): Promise<string>
/// ```
pub async fn executable_path(&self, channel: Option<Value>) -> Result<String, BridgeError> {
self.remote.call("executablePath", vec![channel]).await
}
/// `PuppeteerNode.lastLaunchedBrowser`
///
/// ```text
/// lastLaunchedBrowser(): Promise<SupportedBrowser>
/// ```
pub async fn last_launched_browser(&self) -> Result<String, BridgeError> {
self.remote.call("lastLaunchedBrowser", vec![]).await
}
/// `PuppeteerNode.defaultBrowser`
///
/// ```text
/// defaultBrowser(): Promise<SupportedBrowser>
/// ```
pub async fn default_browser(&self) -> Result<String, BridgeError> {
self.remote.call("defaultBrowser", vec![]).await
}
/// `PuppeteerNode.defaultArgs`
///
/// ```text
/// defaultArgs(options?: LaunchOptions): Promise<string[]>
/// ```
pub async fn default_args(&self, options: Option<Value>) -> Result<Vec<String>, BridgeError> {
self.remote.call("defaultArgs", vec![options]).await
}
/// `PuppeteerNode.trimCache`
///
/// ```text
/// trimCache(): Promise<void>
/// ```
pub async fn trim_cache(&self) -> Result<(), BridgeError> {
self.remote.call("trimCache", vec![]).await
}
/// `PuppeteerNode.setFollowSymlinks`
///
/// ```text
/// setFollowSymlinks(followSymlinks: boolean): void
/// ```
pub async fn set_follow_symlinks(&self, follow_symlinks: bool) -> Result<(), BridgeError> {
self.remote.call("setFollowSymlinks", vec![Some(Value::from(follow_symlinks))]).await
}
}