browser_commander/puppeteer/api/
target.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 Target
15);
16
17impl Target {
18 pub async fn worker(&self) -> Result<Option<WebWorker>, BridgeError> {
24 self.remote.call("worker", vec![]).await
25 }
26
27 pub async fn page(&self) -> Result<Option<Page>, BridgeError> {
33 self.remote.call("page", vec![]).await
34 }
35
36 pub async fn as_page(&self) -> Result<Page, BridgeError> {
42 self.remote.call("asPage", vec![]).await
43 }
44
45 pub async fn url(&self) -> Result<String, BridgeError> {
51 self.remote.call("url", vec![]).await
52 }
53
54 pub async fn create_cdp_session(&self) -> Result<CDPSession, BridgeError> {
60 self.remote.call("createCDPSession", vec![]).await
61 }
62
63 pub async fn r#type(&self) -> Result<String, BridgeError> {
69 self.remote.call("type", vec![]).await
70 }
71
72 pub async fn browser(&self) -> Result<Browser, BridgeError> {
78 self.remote.call("browser", vec![]).await
79 }
80
81 pub async fn browser_context(&self) -> Result<BrowserContext, BridgeError> {
87 self.remote.call("browserContext", vec![]).await
88 }
89
90 pub async fn opener(&self) -> Result<Option<Target>, BridgeError> {
96 self.remote.call("opener", vec![]).await
97 }
98}