Use custom Firefox profiles with selenium grid.
I started using custom Firefox profiles so that I could get around the self signed cert error in firefox. I found a way to easily maintain one configured profile that is used across all Selenium remote control environments running on OS X and multiple windows versions.
- Download the selenium grid software. I am using selenium-grid-1.0.4
- Create a new directory called SeleniumFireFoxProfile in your selenium-grid-1.0.4 directory.
- Start your remote control using the custom profile. rake all:start SELENIUM_ARGS=”-firefoxProfileTemplate SeleniumFireFoxProfile”
- Create a test script to open a selenium client driver and navigate to the site that is getting the ssl cert error. Use a debugger to pause the execution of your script at the browser.open command
- Execute your script to the break point and accept the cert in your Firefox browser.
- Look for the creation of the cert_override.txt file in your user directory. With Firefox 3.0 I found it on my mac in /private/var/folders. I cd to the contained directory and run a find command to locate it sudo find . -name cert_override.txt. With Firefox 3.5 the profile is stored in the user directory ~/Library/Application Support/Firefox/Profiles.
- You should see an entry in your cert_override.txt file after you accept the certificate. Now copy the cert_override.txt from your user directory to your SeleniumFireFoxProfile directory in your selenium grid directory.
- Restart your remote control now using the profile with the cert_override.txt file in it. Rerun your test and break on the open command now you should see your page render instead of the security warning.
Just a warning about the cert_override.txt file. It is very white space sensitive, it is better to copy the whole file into your custom profile directory rather then copying a new line into an existing file.
I check in the override text file along with my selenium software. This way I can add a cert on my local machine and then run a SVN update on the distributed grid hosts to get the new cert information. This works for both windows and OS X.