From e4971fdadfda1de6038274df5f163077de1acb4e Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Fri, 30 Jul 2021 20:10:11 +0200 Subject: fix: login url and sleep between input send keys --- src/browser/web_browser.rs | 6 ++++-- 1 file 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, @@ -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? -- cgit v1.2.3-18-g5258