browser_commander/puppeteer/api/
dialog.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 Dialog
15);
16
17impl Dialog {
18 pub async fn handled(&self) -> Result<bool, BridgeError> {
24 self.remote.get("handled").await
25 }
26
27 pub async fn r#type(&self) -> Result<Value, BridgeError> {
33 self.remote.call("type", vec![]).await
34 }
35
36 pub async fn message(&self) -> Result<String, BridgeError> {
42 self.remote.call("message", vec![]).await
43 }
44
45 pub async fn default_value(&self) -> Result<String, BridgeError> {
51 self.remote.call("defaultValue", vec![]).await
52 }
53
54 pub async fn accept(&self, prompt_text: Option<&str>) -> Result<(), BridgeError> {
60 self.remote.call("accept", vec![prompt_text.map(|x| Value::from(x))]).await
61 }
62
63 pub async fn dismiss(&self) -> Result<(), BridgeError> {
69 self.remote.call("dismiss", vec![]).await
70 }
71}