From 99968c72a5efbd535362e050baf314f9e0cff709 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Fri, 30 Jul 2021 19:24:41 +0200 Subject: refactor: browser as modular funcs --- src/browser/mod.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/browser/mod.rs (limited to 'src/browser/mod.rs') diff --git a/src/browser/mod.rs b/src/browser/mod.rs new file mode 100644 index 0000000..8359c51 --- /dev/null +++ b/src/browser/mod.rs @@ -0,0 +1,19 @@ +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(()) +} -- cgit v1.2.3-18-g5258