From 382c29811553304ec2dcfb828c27f9498d005a31 Mon Sep 17 00:00:00 2001 From: Saumit Dinesan Date: Mon, 9 Jan 2023 11:27:42 +0530 Subject: Update the script upon reaching college --- README.md | 2 +- auto-login.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b12f238..3aa9b3b 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,6 @@ With this it is the same except I get to automate it using [gnu pass](https://ww and that using XPath(XML Path) to find elements is really convenient. ## Future additions: -Update the script upon reaching college as the Xpath values would differ. +~~Update the script upon reaching college as the Xpath values would differ.~~ Make the python-script platform independent or just Make a separate shellscript to log in via CLI using curl. diff --git a/auto-login.py b/auto-login.py index 506d202..ac42011 100644 --- a/auto-login.py +++ b/auto-login.py @@ -12,10 +12,9 @@ from selenium.webdriver.common.by import By driver = webdriver.Firefox() driver.get("http://"+gateway) - -driver.find_element(by=By.XPATH,value="//*[@id='tf1_userName']").send_keys(w_user) -driver.find_element(by=By.XPATH,value="//*[@id='tf1_password']").send_keys(w_pass) -driver.find_element(by=By.XPATH,value="/html/body/div[1]/div/div/div[2]/form/div/div[5]/button").click() +driver.find_element(by=By.XPATH,value="//*[@id='cpusername']").send_keys(w_user) +driver.find_element(by=By.XPATH,value="//*[@id='cppassword']").send_keys(w_pass) +driver.find_element(by=By.XPATH,value="//*[@id='btnLogin']").click() time.sleep(5) if(driver.find_element(by=By.XPATH,value="//*[@id='lblLoggedinUser']").is_displayed()): print("Logged in successfully!") -- cgit v1.2.3