Selenium, Firefox and Self Signed Certificates

A little while ago, I needed to run some Selenium processes against a different server which was https only with a self signed certificate. When Selenium fired up, I saw the SSL certificate warnings followed by the test failing. Even when I inserted a pause into my script so I would have time to add the security exception, the test still failed.

A search on the web led to Elliot Smith’s post entitled Dealing with self-signed SSL certificates when running Selenium server with Firefox. At the time, the post was only a few days old. It was exactly what I needed and worked like a champ. Thank you Elliot!

I would add to Elliot’s procedure that the cert_override.txt and cert8.db files can be added to source control. Even if the person executing the tests has never followed the procedure regarding creating a Firefox profile, the process will still work.

Finally, a minor warning. If you find that you need to add additional self-signed certificates, you will need to do that as part of a full-fledged Firefox profile – not the limited version created here. In that case, just like the first time, you will need to delete all of the Firefox created files and directories except cert_override.txt and cert8.db just like the first time it was setup. (I suppose you could also copy the 2 cert*.* files from a different full fledged profile – as long as you were confident regarding the contents of those files.)