playwright/
imp.rs

1pub(crate) mod impl_future {
2    pub use std::{future::Future, pin::Pin, task};
3}
4pub(crate) mod prelude {
5    pub use serde::{de::DeserializeOwned, Deserialize, Serialize};
6    pub use serde_json::{
7        map::Map,
8        value::Value
9    };
10    pub use std::{
11        collections::HashMap,
12        convert::TryInto,
13        path::{Path, PathBuf},
14        sync::{Arc, Mutex, Weak},
15        task::{Poll, Waker},
16        time::Duration
17    };
18    pub use strong::*;
19    pub type Wm<T> = Weak<Mutex<T>>;
20    pub type Am<T> = Arc<Mutex<T>>;
21
22    #[cfg(feature = "rt-async-std")]
23    #[derive(Debug, thiserror::Error)]
24    pub enum JoinError {}
25    #[cfg(feature = "rt-async-std")]
26    pub use async_std::{task::sleep, task::spawn};
27    #[cfg(feature = "rt-tokio")]
28    pub use tokio::{task::spawn, task::JoinError, time::sleep};
29    #[cfg(feature = "rt-actix")]
30    pub use tokio::{task::spawn, task::JoinError, time::sleep};
31
32    pub(crate) trait RemoveOne<T> {
33        fn remove_one<F>(&mut self, f: F)
34        where
35            F: Fn(&T) -> bool;
36    }
37
38    impl<T> RemoveOne<T> for Vec<T> {
39        fn remove_one<F>(&mut self, f: F)
40        where
41            F: Fn(&T) -> bool
42        {
43            let index = match self.iter().position(f) {
44                Some(i) => i,
45                None => return
46            };
47            self.remove(index);
48        }
49    }
50}
51
52#[macro_use]
53mod macros {
54    #[doc(hidden)]
55    #[macro_export]
56    macro_rules! get_object {
57        ($c:expr, $guid:expr, $t:ident) => {
58            match $c.find_object($guid) {
59                Some(RemoteWeak::$t(x)) => Ok(x),
60                _ => Err(Error::ObjectNotFound)
61            }
62        };
63    }
64
65    #[doc(hidden)]
66    #[macro_export]
67    macro_rules! send_message {
68        ($r: expr, $method:literal, $args: expr) => {{
69            let m: Str<Method> = $method.to_owned().try_into().unwrap();
70            let r = $r.channel().create_request(m).set_args($args)?;
71            let fut = $r.channel().send_message(r).await?;
72            let res = fut.await?;
73            let res = res.map_err(Error::ErrorResponded)?;
74            res
75        }};
76    }
77}
78
79pub(crate) mod core {
80    mod connection;
81    mod driver;
82    mod event_emitter;
83    mod message;
84    mod remote_object;
85    mod transport;
86    pub use connection::*;
87    pub use driver::*;
88    pub use event_emitter::*;
89    pub use message::*;
90    pub(crate) use remote_object::*;
91    pub use transport::*;
92}
93
94pub(crate) mod browser_type;
95pub(crate) mod playwright;
96pub(crate) mod selectors;
97pub(crate) mod utils;
98
99pub(crate) mod artifact;
100pub(crate) mod binding_call;
101pub(crate) mod browser;
102pub(crate) mod browser_context;
103pub(crate) mod console_message;
104pub(crate) mod dialog;
105pub(crate) mod download;
106pub(crate) mod element_handle;
107pub(crate) mod file_hooser;
108pub(crate) mod frame;
109pub(crate) mod js_handle;
110pub(crate) mod page;
111pub(crate) mod request;
112pub(crate) mod response;
113pub(crate) mod route;
114pub(crate) mod stream;
115pub(crate) mod video;
116pub(crate) mod websocket;
117pub(crate) mod worker;
118
119//_accessibility.py
120//_api_structures.py
121//_api_types.py
122//_element_handle.py
123//_event_context_manager.py
124//_helper.py
125//_impl_to_api_mapping.py
126//_input.py
127//_path_utils.py
128//_sync_base.py
129//_video.py
130//_wait_helper.py
131// ChromiumBrowserContext CdpSession