gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 11:06:40 25 4
gpt4 key购买 nike

尝试使用 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com