[英]Using Selenium to By-pass SSL Certification In Internet Explorer (Python)
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. 本质上,我试图编写一个利用Selenium打开特定站点并输入用户登录信息的脚本。 However, Internet Explorer returns a certificate warning as shown: 但是,Internet Explorer返回证书警告,如下所示:
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. 我试过在硒中使用html和get_element_by_id功能以及功能控件,但没有任何效果。 Any suggestions? 有什么建议么?
Thanks, Travis 谢谢特拉维斯
SSL error page in IE isn't Shadow DOM, you can navigate on the page and just click on "Continue". IE中的SSL错误页面不是Shadow DOM,您可以在页面上导航,然后单击“继续”。 Try 'find_element' : 尝试'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()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.