【问题标题】:Python Selenium Webdriver to open untrusted connectionsPython Selenium Webdriver 打开不受信任的连接
【发布时间】:2013-08-23 08:37:39
【问题描述】:

谁能帮我在 python 中使用 selenium webdriver 打开一个安全的 http (https) 页面?

页面一打开就显示证书错误“不受信任的连接”。

我尝试了以下代码,但它对我不起作用 -

from selenium import webdriver

profile = webdriver.firefox.firefox_profile.FirefoxProfile()
#profile.accept_untrusted_certs = 'true'

profile.default_preferences["webdriver_assume_untrusted_issuer"] = 'false'
profile.update_preferences()

browser = webdriver.Firefox(profile)
browser.get('https://192.168.20.35:8443')

-

selenium webdriver 版本 - 2.35.0

Python 版本 - 2.7.2

【问题讨论】:

    标签: python selenium https


    【解决方案1】:

    当浏览器不接受/不信任网站的证书时出现。要接受 Firefoxcertificate,您可以运行:

        ProfilesIni profile = new ProfilesIni();
        FirefoxProfile myprofile = profile.getProfile("default");
        myprofile.setAcceptUntrustedCertificates(true);
        myprofile.setAssumeUntrustedCertificateIssuer(true);
        WebDriver driver = new FirefoxDriver(myprofile);
    

    【讨论】:

      猜你喜欢
      • 2013-10-10
      • 2012-11-03
      • 2021-05-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-18
      • 1970-01-01
      相关资源
      最近更新 更多