A common problem many Selenium users run into is the untrusted connection warning.
This happens when an SSL certificate is unsigned, self-signed, or doesn’t match the domain name, a common scenario in test environments. In Firefox it used to be a popup modal dialog that needed dismissed by clicking “ok” or “so what” or something along those lines. More recent versions of Firefox (I have 3.5.8) bring up an intermediate page that says “This Connection is Untrusted” and looks like this:
What should you do?
- Click “I Understand the Risks”
- Click “Add Exception”
- Click “Get Certificate”
- Make sure “Permanently store this exception” is checked (it is by default)
- Click “Confirm Security Exception”
There, now don’t you feel safer for all that clicking.
Earlier releases of Firefox 3.5 had a bug that it wouldn’t “permanently” store the SSL Certificate, and there was even a plugin created to fix that.
But that’s only by default. You can tell Selenium to use an existing profile as a template by passing the -firefoxProfileTempate flag like this:
java -jar selenium-server.jar -firefoxProfileTemplate "c:\Documents and Settings\Aaron Evans\Application Data\Mozilla\Firefox\Profiles\5rdxety0.default"
If you’ve already dismissed the dire warnings manually with your existing profile, now Selenium will sail right through. But only if you use Firefox. I’ll tell you how to get past this problem with IE, Opera, Chrome, and Safari another day.
- Close all your firefox windows down (don’t forget the quick launch if you have that)
- Launch firefox from the command line with
firefox.exe -ProfileManager -no-remote
- Click “Create Profile”
- Click “Next” on the Create Profile Wizard” nonsense popup
- Create a name for your new profile — I think “Selenium” is pretty descriptive
- Click “Choose Folder”
- Pick something easy to find — like “C:\selenium\firefox_profile”
- Click Finish
Now click through and accept all the SSL certificates on the site you need to run Selenium tests on, repeating the process described above.
Finally, launch selenium-server and specify the profile you just created:
java -jar selenium-server.jar -firefoxProfileTemplate c:\selenium\firefox_profile
You can do a bunch of other cool stuff with your firefox profile for selenium, but we’ll talk about that later. I’m eager to hear what others have done as well.
One thing I’d like to figure out is how to get rid of that update manager popup that shows up every time I run tests (but doesn’t interfere with them.)