I have done some searching on this issue and have not found any working solutions. Essentially, I am trying to write a script that utilizes Selenium to open a particular site and enter user login information. However, Internet Explorer returns a certificate warning as shown:
Here is the code I am using
class PipelinePilotControl:
user_id = str(input("Please enter your username.\n"))
user_password = getpass.getpass(prompt="Please enter your password.\n")
def pipelinepilot_login(self):
ie_browser_driver = webdriver.Ie()
ie_browser_driver.get("url to be accessed")
user_login = ie_browser_driver.find_element_by_id("txtUsername")
password_login = ie_browser_driver.find_element_by_id("txtPassword")
login_button = ie_browser_driver.find_element_by_id("btnLogin")
user_login.send_keys(self.user_id)
password_login.send_keys(self.user_password)
login_button.send_keys(Keys.ENTER)
I have tried using the html and the get_element_by_id functionality in selenium as well as capability controls but nothing has worked. Any suggestions?
Thanks, Travis
SSL error page in IE isn't Shadow DOM, you can navigate on the page and just click on "Continue". Try 'find_element' :
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
caps = webdriver.DesiredCapabilities().INTERNETEXPLORER
caps['acceptSslCerts'] = True
driver = webdriver.Ie(capabilities=caps)
driver.get('https://yourwebsite.com/')
overrideLink = driver.find_element_by_id('overridelink')
overrideLink.click()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.