summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaumit Dinesan <justsaumit@protonmail.com>2023-01-09 11:27:42 +0530
committerSaumit Dinesan <justsaumit@protonmail.com>2023-01-09 11:27:42 +0530
commit382c29811553304ec2dcfb828c27f9498d005a31 (patch)
tree89d967ec990689d8d19bdbd92a4f32fa5c0d42d3
parent94d6ac5906b71397bd618d342047aecf37427b19 (diff)
Update the script upon reaching college
-rw-r--r--README.md2
-rw-r--r--auto-login.py7
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!")