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
94
95
96
97
98
// @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 `Target` (puppeteer-core 25.12.0), a remote object
/// served by `browser-commander serve --stdio`.
Target
);
impl Target {
/// `Target.worker`
///
/// ```text
/// worker(): Promise<WebWorker | null>
/// ```
pub async fn worker(&self) -> Result<Option<WebWorker>, BridgeError> {
self.remote.call("worker", vec![]).await
}
/// `Target.page`
///
/// ```text
/// page(): Promise<Page | null>
/// ```
pub async fn page(&self) -> Result<Option<Page>, BridgeError> {
self.remote.call("page", vec![]).await
}
/// `Target.asPage`
///
/// ```text
/// asPage(): Promise<Page>
/// ```
pub async fn as_page(&self) -> Result<Page, BridgeError> {
self.remote.call("asPage", vec![]).await
}
/// `Target.url`
///
/// ```text
/// url(): string
/// ```
pub async fn url(&self) -> Result<String, BridgeError> {
self.remote.call("url", vec![]).await
}
/// `Target.createCDPSession`
///
/// ```text
/// createCDPSession(): Promise<CDPSession>
/// ```
pub async fn create_cdp_session(&self) -> Result<CDPSession, BridgeError> {
self.remote.call("createCDPSession", vec![]).await
}
/// `Target.type`
///
/// ```text
/// type(): TargetType
/// ```
pub async fn r#type(&self) -> Result<String, BridgeError> {
self.remote.call("type", vec![]).await
}
/// `Target.browser`
///
/// ```text
/// browser(): Browser
/// ```
pub async fn browser(&self) -> Result<Browser, BridgeError> {
self.remote.call("browser", vec![]).await
}
/// `Target.browserContext`
///
/// ```text
/// browserContext(): BrowserContext
/// ```
pub async fn browser_context(&self) -> Result<BrowserContext, BridgeError> {
self.remote.call("browserContext", vec![]).await
}
/// `Target.opener`
///
/// ```text
/// opener(): Target | undefined
/// ```
pub async fn opener(&self) -> Result<Option<Target>, BridgeError> {
self.remote.call("opener", vec![]).await
}
}