【问题标题】:How to import SSL certificates for Firefox with Selenium [in Python]?如何使用 Selenium [in Python] 为 Firefox 导入 SSL 证书?
【发布时间】:2013-06-30 12:26:24
【问题描述】:

尝试使用 Python WebDriver 和 FirefoxProfile 找到一种在带有 Selenium 的 Firefox 中安装特定 SSL 证书的方法。我们需要使用我们自己的自定义证书,该证书存储在运行 WebDriver 的计算机中,因此理想的解决方案如下所示:

profile = get_my_profile()
profile.importCertificate('/my/certificates/my_cert.cert')
driver = new webdriver.Firefox(profile=profile)

我怎样才能做到这一点?

非常感谢!

【问题讨论】:

    标签: python ssl selenium webdriver certificate


    【解决方案1】:

    From this answer

    Webdriver 没有用于添加个人证书的内置机制。

    如果您使用的是 firefox,我发现这样做的唯一方法是 创建一个 Firefox 配置文件并将证书添加到其中。你可以 然后在运行测试时重用配置文件,或者,这是 我的首选选项,获取 cert8.db 和 key3.db 文件并添加它们 到 webdriver 在运行时创建的配置文件。 - Derek Ekins

    虽然下一个答案提供了workaround

    【讨论】:

      猜你喜欢
      • 2016-10-18
      • 2016-06-05
      • 1970-01-01
      • 1970-01-01
      • 2018-05-30
      • 1970-01-01
      • 2014-11-10
      • 2013-05-29
      • 2010-10-15
      相关资源
      最近更新 更多