diff options
author | Saumit Dinesan <justsaumit@protonmail.com> | 2023-02-01 01:57:24 +0530 |
---|---|---|
committer | Saumit Dinesan <justsaumit@protonmail.com> | 2023-02-01 01:57:24 +0530 |
commit | c3616fad8e3b72e226b6f241c09c5833b7041955 (patch) | |
tree | ea32a1549ebfb4d451cec34046e56b42f2d84bc3 | |
parent | 8c101e2cf8dde65541381c4adef6ca2144f21593 (diff) |
Using Options class instead of the deprecated FirefoxProfile class + README changes(rebase)
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | auto-login.py | 10 |
2 files changed, 10 insertions, 6 deletions
@@ -5,8 +5,10 @@ A small python script which allows you to automatically login to a captive porta ## Pre-Requisites: [Selenium Webdriver](https://www.selenium.dev/documentation/webdriver/) for Python (install using `pip install selenium` or `pip install -r requirements.txt`) [GNU pass](https://www.passwordstore.org/) for storing login-credentials (One can store their credentials in the script as plaintext aswell) -geckodriver for Firefox in PATH (optional if not already included in selenium webdriver) -([Download link](https://github.com/mozilla/geckodriver/releases)) +geckodriver for Firefox ([Download link](https://github.com/mozilla/geckodriver/releases)) +Add the location of the geckodriver executable to your system's PATH environment variable. +[Tutorial](https://www.learningaboutelectronics.com/Articles/How-to-install-geckodriver-Python-windows.php) + ## Brief Look: [![auto-login](https://draconyan.xyz/media/al/auto-login-clg.gif)](https://draconyan.xyz/media/al/auto-login-clg.mp4) diff --git a/auto-login.py b/auto-login.py index 39952a6..2475a1f 100644 --- a/auto-login.py +++ b/auto-login.py @@ -10,15 +10,17 @@ gateway=pipedps.communicate()[0].decode().strip() from selenium import webdriver from selenium.webdriver.common.by import By -profile = webdriver.FirefoxProfile() -profile.accept_untrusted_certs = True +options = webdriver.FirefoxOptions() +options.set_capability("acceptInsecureCerts", True) +options.set_capability("assume_untrusted_cert_issuer", True) -driver = webdriver.Firefox(firefox_profile=profile) + +driver = webdriver.Firefox(options=options) driver.get("http://"+gateway) 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) +time.sleep(9) if(driver.find_element(by=By.XPATH,value="//*[@id='btnLogout']").is_displayed()): print("Logged in successfully!") else: |