微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

尝试使用Python WebDriver和FirefoxProfile找到一种使用Selenium在Firefox中安装特定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. – 07001

虽然下一个答案提供了workaround.

原文地址:https://codeday.me/bug/20190629/1326514.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐