Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

barbie (2653)

  reversethis-{ku. ... m} {ta} {eibrab}

Leader of [] and a CPAN author []. Co-organised YAPC::Europe in 2006 and the 2009 QA Hackathon, responsible for the YAPC Conference Surveys [] and the QA Hackathon [] websites. Also the current caretaker for the CPAN Testers websites and data stores.

If you really want to find out more, buy me a Guinness ;)

Memoirs of a Roadie []
CPAN Testers Reports []
YAPC Conference Surveys []
QA Hackathon []

Journal of barbie (2653)

Thursday July 12, 2007
04:21 AM

Selenium, Firefox and a FoxyProxy

[ #33790 ]

Following a trail of links yeterday I finally found a solution to my troubles of running Firefox with Selenium. I'm posting it here in the hope it might actually help anyone else in the same situation. It all comes down to configuring proxy settings. It never occurred to me that several browsers would override the settings passed to them from the selenium-rc server, but it would seem they do. As a consequence I was pointed at the FoxyProxy extension for Firefox and asked to point the proxy settings to 'http://localhost:4444', which is the server/port the selenium-rc server is listening on. I then fired up the tests and low and behold away we go.

I've tried this on the other three browsers and it would appear that Amaya doesn't support javascript, at least not to the level required for Selenium and Dillo just fails, although I'm not quite sure why, as it doesn't even load the web page. Epiphany requires you to jump through hoops to change system proxy settings, which is not what I want to do, as these machines aren't dedicated to just Selenium testing. I find it a bit odd that this is something every other browser has take into consideration, but Epiphany is lacking.

However, my initial problem was Firefox, and the FoxyProxy extension is rather nice. Not only can I set up various proxies, I can also set a proxy to activate based on a simple wildcard pattern matching expression. Configuring the browser to route through to the selenium-rc server any time that '*/selenium-server/core/*' was spotted took seconds. So now I have a Selenium working Firefox, but it does come with two notably large caveats, which apply to both Linux and Windows.

Firstly, before starting the selenium-rc server or running any tests, you will need to launch an instance of Firefox first, which is not too much of a problem for me as my slides are HTML and I usually use Firefox to run through them. Secondly, you must use the following as your browser setting in your test scripts: '*custom firefox -chrome'. Note that both '*firefox' and '*chrome' will not work. On Windows you will also need to ensure that the path to the Firefox binary is in your PATH environment variable. Once the tests have run you'll also note that the chrome browser window used to run the test will still be open. It appears there is a problem with Selenium knowing how to close the browser. This isn't a big deal and I expect that'll be fixed in a future version.

So the next stage was to run my tests. I was hoping they would be good after all this effort to get it working, but I have to say I was a little disappointed. The test script ran in 89 seconds, 1 second faster than IE, but 7 seconds slower than Konqueror. I know I shouldn't be disappointed as it is still a decent speed, but I was hoping it would be a significant improvement. At least I now have some filler stories to tell my audience while the demos are running :)

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.