Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import SSL certificates for Firefox with Selenium [in Python]?

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!

like image 324
Juan Carlos Coto Avatar asked Jul 02 '13 23:07

Juan Carlos Coto


1 Answers

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.

like image 164
John Avatar answered Oct 27 '22 19:10

John