diff options
Diffstat (limited to 'src')
| -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(())  } | 
