如何使用Selenium在Python中导入Firefox的SSL证书? [英] How to import SSL certificates for Firefox with Selenium [in Python]?

查看:1024
本文介绍了如何使用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)


非常感谢!

$

b $ b

解决方案

从此回答


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



firefox我发现要做到这一点的唯一方式是
创建一个firefox配置文件并添加证书到它。你可以
然后重新使用配置文件,当你运行你的测试OR,这是
我的首选的选项,采取cert8.db和key3.db文件,并将他们
添加到配置文件webdriver在运行时创建。 - Derek Ekins


,但下一个答案提供了解决方法


Trying to find a way to install a particular SSL certificate in Firefox with Selenium, using the Python WebDriver and FirefoxProfile. We need to use our own, custom certificate which is stored in the computer running the WebDriver, so the ideal solution would look like this:

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

How can I achieve this?

Thanks very much!

解决方案

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

although the next answer provides a workaround.

这篇关于如何使用Selenium在Python中导入Firefox的SSL证书?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆