Tuesday, March 3, 2009

Why is Selenium starting all my Firefox windows with an empty profile?

One of the things I love about Firefox is how you can customize it. I will forever use Firefox because of the web developer plugin. I save countless hours by editing HTML and CSS in place with this plugin, bypassing the various pitfalls of different web UI frameworks. One reason why we started using Selenium is because of the Selenium IDE plugin.

So imagine how startled I was when my automated UI tests started popping up screens on my desktop with the empty default profile. Writing a test is like writing other code--you make mistakes. And to fix those mistakes, you need the Selenium IDE. But the plugin wasn't showing up in the Firefox windows that my test cases were spawning.

Simple solution here: when you start up the selenium server (I use selenium-server.jar), tell it where your Firefox profile is by using the firefoxProfileTemplate option. On my Mac, it's under /Users/[your user name]/Library/Application Support/Firefox/Profiles.

This cuts both ways, however. If you have some non-standard plugins (such as NoScript), you may end up running your Selenium tests in an environment that's totally different from that of your typical user, which is a major no-no. To avoid this, you could configure a different, cleaner profile, marred only by the Selenium IDE plugin. Or you could be lazy like me and just leave it to the build and QA team to run the tests in a cleanroom.

No comments:

Post a Comment