From 6ce7b3a5e4edfc2685468e4df31de6463bddcd6e Mon Sep 17 00:00:00 2001 From: Saumit Dinesan Date: Mon, 23 Jan 2023 11:31:15 +0530 Subject: Using Options class instead of the deprecated FirefoxProfile class + README changes --- auto-login.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'auto-login.py') 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: -- cgit v1.2.3