如何为Firefox导入Selenium(在Python中)的SSL证书?

2024-06-02 07:26:31 发布

您现在位置:Python中文网/ 问答频道 /正文

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

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

我怎样才能做到这一点?

非常感谢!


Tags: sslgetcertmyselenium计算机firefox解决方案
1条回答
网友
1楼 · 发布于 2024-06-02 07:26:31

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

相关问题 更多 >