blob: 2765c6d968c24329133f633fe37eb5af6c7c9c11 (
plain)
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
|
use std::collections::HashMap;
use self::web_browser::{Browser, WEB_BROWSER};
use crate::Config;
use thirtyfour::prelude::WebDriverResult;
mod web_browser;
pub async fn init(driver_url: &String) {
unsafe {
WEB_BROWSER = Some(Browser::new(driver_url).await);
}
}
pub async unsafe fn login(credentials: &Config) -> WebDriverResult<()> {
if let Some(driver) = &WEB_BROWSER {
driver._login(credentials).await?;
}
Ok(())
}
pub async unsafe fn get_faculties() -> WebDriverResult<Option<HashMap<String, String>>> {
if let Some(driver) = &WEB_BROWSER {
match driver.faculties().await? {
Some(faculties) => {
return Ok(Some(faculties));
}
None => {
return Ok(Some(HashMap::<String, String>::new()));
}
};
}
Ok(Some(HashMap::<String, String>::new()))
}
|