If you’re developing a web app that has a SSL certificate and for whatever reason the url being used to access the app doesn’t match the one stored in the certificate, then you’ll get a little warning message from the browser (example taken from FireFox):
You have attempted to establish a connection with “url-used-in-the-browser”. However, the security certificate presented belongs to “url-defined-in-the-certificate”. It is possible, though unlikely, that someone may be trying to intercept your communication with this site.
Most of the time, this invalid certificate warning is merely an annoyance. By clicking “OK” you can continue to the site without having to worry about the certificate problem for the remainder of the session. But if you are attempting to run automated Selenium tests against your web app, this little warning prompt is troublesome.
Selenium is an awesome test framework that uses JavaScript to run tests against your web app. By loading a single url in your browser, Selenium can run a whole suite of tests. But if there’s a ssl cert warning message, everything grinds to a halt. Unfortunately Selenium’s JavaScript can’t click the “OK” button to get past the message. This is bad if your tests are running automatically.
A solution to this problem is to use FireFox with the Remember Mismatched Domains (RMD) addon. This awesome addon written by Andrew Lucking gives the user the option to remember which url’s loaded into the browser have mismatched ssl certificates. Now once you “OK” one of these urls, you have to option to have FireFox remember. From that point on, you won’t end up with that pesky little warning message.
And if you’re running FireFox on OS X, check out this blog post or click here to install RMD for FireFox on OS X.


9 Comments
Doesn’t Selenium open an instance of Firefox that does not load any add-ons? I’m trying it now, hopefully it works.
That depends on how FireFox is started. If it is started using a specific profile, then you need to install any addons to that profile of FireFox. Just wait until selenium opens FireFox to run your tests, then use that instance of the browser to install RMD.
Its not working for me [:(]
Does the plugin simply not work for you or are you having problems getting it to work with selenium?
I doesn’t work for me either. It works correctly with Firefox itself, but when Firefox is launched by Selenium, the add-on simply doesn’t appear on the list of add-ons. I tried to install it as you suggest with an instance of the browser opened by Selenium but it doesn’t work either.
Any idea about how to solve the problem would be really appreciated.
Kind regards,
Gerardo
Same problem. Selenium RC launches a virgin copy of Firefox so adding plugins is out. I tried adding the cert_exceptions.txt file with the offending cert in it to /Applications/Firefox.app/Content/OSX to no avail. Any ideas are appreciated.
Does anyone know how to solve this problem on IE7?
thanks in advance
I created a Firefox user profile for Selenium tests (to use a specific browser add-on) and tried to get it to use that profile (based on http://seleniumhq.org/documentation/remote-control/options.html, cmd output below) instead of using a clean one each time, but still no luck.
Any ideas?
Thanks.
C:\Selenium\selenium-remote-control-1.0-beta-1\selenium-server-1.0-beta-1>java -
jar selenium-server.jar -firefoxProfileTemplate C:\Selenium\FF_user_profile
17:07:21.854 INFO – Java: Sun Microsystems Inc. 11.2-b01
17:07:21.854 INFO – OS: Windows XP 5.1 x86
17:07:21.854 INFO – v1.0-beta-1 [2201], with Core v1.0-beta-1 [1994]
17:07:21.932 INFO – Version Jetty/5.1.x
17:07:21.932 INFO – Started HttpContext[/selenium-server/driver,/selenium-server
/driver]
17:07:21.932 INFO – Started HttpContext[/selenium-server,/selenium-server]
17:07:21.932 INFO – Started HttpContext[/,/]
17:07:21.948 WARN – Failed to start: SocketListener0@0.0.0.0:4444
Exception in thread “main” org.mortbay.util.MultiException[java.net.BindExceptio
n: Address already in use: JVM_Bind]
at org.mortbay.http.HttpServer.doStart(HttpServer.java:686)
at org.mortbay.util.Container.start(Container.java:72)
at org.openqa.selenium.server.SeleniumServer.start(SeleniumServer.java:8
59)
at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:37
2)
java.net.BindException: Address already in use: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(Unknown Source)
at java.net.ServerSocket.bind(Unknown Source)
at java.net.ServerSocket.(Unknown Source)
at org.mortbay.util.ThreadedServer.newServerSocket(ThreadedServer.java:3
91)
at org.mortbay.util.ThreadedServer.open(ThreadedServer.java:477)
at org.mortbay.util.ThreadedServer.start(ThreadedServer.java:503)
at org.mortbay.http.SocketListener.start(SocketListener.java:203)
at org.mortbay.http.HttpServer.doStart(HttpServer.java:716)
at org.mortbay.util.Container.start(Container.java:72)
at org.openqa.selenium.server.SeleniumServer.start(SeleniumServer.java:8
59)
at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:37
2)
C:\Selenium\selenium-remote-control-1.0-beta-1\selenium-server-1.0-beta-1>
Hi All,
If you are still having problems with self-signed SSL certificates in FF, check out my solution.
http://jktechtrip.wordpress.com/2011/04/14/selenium-and-self-signed-ssl-...
Hope this work also for you
Regards,
J