diff options
author | Santo Cariotti <santo@dcariotti.me> | 2021-07-29 21:51:23 +0200 |
---|---|---|
committer | Santo Cariotti <santo@dcariotti.me> | 2021-07-29 21:51:23 +0200 |
commit | 60af8fbaa361fc233236675c20b0489f05288a59 (patch) | |
tree | 0dc7a9f1bda4038efe98edcba4a68a87711d8987 | |
parent | 6e6ad7bf49f3517c2e8f69e6376a601aa404f668 (diff) |
chore: use login url as const variable
-rw-r--r-- | src/browser.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/browser.rs b/src/browser.rs index 9846841..de7efaf 100644 --- a/src/browser.rs +++ b/src/browser.rs @@ -3,6 +3,8 @@ use std::{thread, time}; use thirtyfour::prelude::{By, WebDriverResult}; use thirtyfour::{FirefoxCapabilities, WebDriver, WebDriverCommands}; +const LOGIN_URL: &str = "https://studenti.smartedu.unict.it/WorkFlow2011/Logon/Logon.aspx"; + pub async fn init() -> WebDriver { let driver = match WebDriver::new("http://localhost:4444", FirefoxCapabilities::new()).await { Ok(driver) => driver, @@ -15,9 +17,7 @@ pub async fn init() -> WebDriver { } pub async fn login(driver: &WebDriver, credentials: &Config) -> WebDriverResult<()> { - driver - .get("https://studenti.smartedu.unict.it/WorkFlow2011/Logon/Logon.aspx") - .await?; + driver.get(LOGIN_URL).await?; let cf_input = driver .find_element(By::Name("ctl01$contents$UserName")) @@ -37,5 +37,7 @@ pub async fn login(driver: &WebDriver, credentials: &Config) -> WebDriverResult< .click() .await?; + thread::sleep(time::Duration::from_millis(2000)); + Ok(()) } |