diff options
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | auto-login.py | 7 |
2 files changed, 4 insertions, 5 deletions
@@ -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!") |