How do I prevent Selenium RC from stealing window focus while my tests are running? How do I prevent Selenium RC from stealing window focus while my tests are running? selenium selenium

How do I prevent Selenium RC from stealing window focus while my tests are running?


On Linux, you can start up a vncserver on a different display (say, :8 or something) and then have Selenium and your Firefox instances use that display. Works well for us where I work.


Run it in a VM. Has an extra benefit of ability to test under different OS and browsers.

It is my understanding that you cannot avoid stealing focus while on the same machine.


Are you running linux? The FirefoxProfile class has a poorly documented setting that loads a special library to avoid focus stealing on linux - set this to true:

http://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/firefox/FirefoxProfile.html#setAlwaysLoadNoFocusLib(boolean)