HTTP Auth and Selenium

I'm starting to look at Selenium-RC at work today. We're moving a lot of web based functional tests away from PBP.

I ran into a major problem straight away. Our web interface uses Basic HTTP Auth and Firefox insists on presenting a dialog to the (non-existent) user when you open a style URL. The tests would hang waiting for the Ok button click.

After a lot of searching I finally found the network.http.phishy-userpass-length. option. When set to 255 the authentication warning dialog box isn't shown.

Selenium creates a fresh Firefox profile every time it starts Firefox so modifying the option in about:config doesn't help. You need to edit firefox.js and add a line like pref("network.http.phishy-userpass-length", 255);. This ensures that the option is set in any new profile. On Windows firefox.js can probably be found at Program Files\Mozilla Firefox\defaults\prefs\firefox.js. It'll probably be at /usr/lib/firefox-*/defaults/pref/firefox.js on a Linux machine.

I wonder if Selenium-RC could set this option in profiles it creates itself? It already seems to set a bunch of other options.


Comments powered by Disqus