diff options
author | Santo Cariotti <santo@dcariotti.me> | 2021-07-30 20:10:11 +0200 |
---|---|---|
committer | Santo Cariotti <santo@dcariotti.me> | 2021-07-30 20:10:11 +0200 |
commit | e4971fdadfda1de6038274df5f163077de1acb4e (patch) | |
tree | a09c586e344c3472f7db447592e49bba522a8ff5 | |
parent | ae38752e503ce921bea34e72415be4b4aadcdf68 (diff) |
fix: login url and sleep between input send keys
-rw-r--r-- | src/browser/web_browser.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/browser/web_browser.rs b/src/browser/web_browser.rs index 53b8baa..da8bcd1 100644 --- a/src/browser/web_browser.rs +++ b/src/browser/web_browser.rs @@ -4,7 +4,7 @@ use thirtyfour::error::{WebDriverError, WebDriverErrorInfo, WebDriverErrorValue} use thirtyfour::prelude::{By, WebDriverResult}; use thirtyfour::{FirefoxCapabilities, WebDriver, WebDriverCommands}; -const LOGIN_URL: &str = "https://studenti.smartedu.unict.it/WorkFlow2011/Logon/Logon.aspx"; +const LOGIN_URL: &str = "https://studenti.smartedu.unict.it/WorkFlow2011/Logon/Logon.aspx?ReturnUrl=%2fStudenti%2fDefault.aspx"; pub struct Browser { driver: Option<WebDriver>, @@ -33,12 +33,14 @@ impl Browser { let cf_input = _d.find_element(By::Name("ctl01$contents$UserName")).await?; cf_input.send_keys(&credentials.cf).await?; + thread::sleep(time::Duration::from_millis(3000)); + let psw_input = _d .find_element(By::Name("ctl01$contents$UserPassword")) .await?; psw_input.send_keys(&credentials.password).await?; - thread::sleep(time::Duration::from_millis(1000)); + thread::sleep(time::Duration::from_millis(3000)); _d.find_element(By::Name("ctl01$contents$LogonButton")) .await? |