简体   繁体   English

在Internet Explorer(Python)中使用Selenium绕过SSL认证

[英]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.

相关问题 如何使用 Python 避免 Selenium Webdriver 中的 SSL 认证错误? - How to avoid SSL certification error in Selenium Webdriver using Python? Selenium 在 Inte.net Explorer 中用 Python 测试 - Selenium test with Python in Internet Explorer 如何使用Selenium和Python查找元素Internet Explorer - How to find element Internet Explorer, using selenium and Python 如何使用python selenium获取Internet Explorer的浏览器控制台日志 - How to get the browser console logs of internet explorer using python selenium 使用 Selenium Python 在私有模式下打开 Internet Explorer - Opening Internet Explorer in Private Mode with Selenium Python Python Selenium Inte.net Explorer 模式下的 Edge 浏览器 - Python Selenium Edge Browser in Internet Explorer mode 为什么在Internet Explorer中使用python中的Selenium时单击事件不起作用? - Why click event doesn't work in Internet Explorer using Selenium in python? 如何使用 python 和 selenium 在 Internet Explorer(IE)模式下打开 Microsoft Edge? - How to open Microsoft Edge in Internet Explorer(IE) Mode using python and selenium? Tensorflow中的Python SSL认证问题 - Python SSL Certification Problems in Tensorflow 硒+ Python + Internet Explorer +公司代理+ PAC文件+凭据 - Selenium + Python + Internet Explorer + Firm Proxy + PAC file + Credentials
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM