From 60af8fbaa361fc233236675c20b0489f05288a59 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Thu, 29 Jul 2021 21:51:23 +0200 Subject: chore: use login url as const variable --- src/browser.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') 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(()) } -- cgit v1.2.3-18-g5258