chrome_for_testing_manager/
session.rs1#[derive(Debug)]
6pub struct Session {
7 #[cfg(feature = "thirtyfour")]
8 pub(crate) driver: thirtyfour::WebDriver,
9}
10
11#[cfg(feature = "thirtyfour")]
12pub type SessionError = thirtyfour::error::WebDriverError;
13
14#[cfg(not(feature = "thirtyfour"))]
15pub type SessionError = anyhow::Error;
16
17impl Session {
18 pub async fn quit(self) -> Result<(), SessionError> {
19 #[cfg(feature = "thirtyfour")]
20 {
21 self.driver.quit().await
22 }
23
24 #[cfg(not(feature = "thirtyfour"))]
25 {
26 unimplemented!()
27 }
28 }
29}
30
31#[cfg(feature = "thirtyfour")]
32impl std::ops::Deref for Session {
33 type Target = thirtyfour::WebDriver;
34
35 fn deref(&self) -> &Self::Target {
36 &self.driver
37 }
38}
39
40#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
41pub struct SessionHandle {
42 pub(crate) session_id: uuid::Uuid,
43}