python - 如何使用 Selenium [在 Python 中] 为 Firefox 导入 SSL 证书?

标签 python ssl selenium webdriver certificate

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

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

我怎样才能做到这一点?

非常感谢!

最佳答案

From this answer

Webdriver has no built in mechanism for adding a personal cert.

If you are using firefox the only way that I have found to do this is to create a firefox profile and add the certificate to it. You can then either reuse the profile when you run your tests OR, and this is my prefered option, take the cert8.db and key3.db files and add them to the profile that webdriver creates at runtime. - Derek Ekins

尽管下一个答案提供了一个 workaround .

关于python - 如何使用 Selenium [在 Python 中] 为 Firefox 导入 SSL 证书?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17437407/

相关文章:

selenium - 在 Selenium 中, sendKeys() 和 setValue() 方法究竟有何不同?

java - 如何通过 Java 使用 Selenium 在 Instagram 中定位带有文本 Not Now 的元素

python - 如何按中值对 pandas 中的箱线图进行排序?

当进程是守护进程时,python 的多处理模块的 join()

c++ - openssl api禁用身份验证

asp.net - 在 SSL 上使用服务器证书时出现 HTTP 错误 403.7

python - 高斯核的 FFT 不正确

python - 用 "Element Number"替换数组中的元素 (Python)

python - 验证 python 2.7 (https) 中任何给定 URL 的 SSL 加密

java - 部分内的按钮需要 XPath