When I execute multiple test simultaneously, i don\'t want to keep Firefox browser window visible.. I can minimize it using selenium.minimizeWindow()
but I don\
I had a similar problem with ChromeDriver (I needed to minimize the browser window while the tests are running). I could not find a better way to do it, so I ended up using the keyboard combination Alt+Space, N to do it. This should work only in Windows, the example uses the Java AWT Robot class to play the keyboard shortcuts:
//Alt + Space to open the window menu
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_ALT);
robot.keyPress(KeyEvent.VK_SPACE);
robot.keyRelease(KeyEvent.VK_SPACE);
robot.keyRelease(KeyEvent.VK_ALT);
Thread.sleep(200);
// miNimize
robot.keyPress(KeyEvent.VK_N);
robot.keyRelease(KeyEvent.VK_N);
I used xvfb to solve the problem like this.
First, install Xvfb:
# apt-get install xvfb
on Debian/Ubuntu; or
# yum install xorg-x11-Xvfb
on Fedora/RedHat. Then, choose a display number that is unlikely to ever clash (even if you add a real display later) – something high like 99 should do. Run Xvfb on this display, with access control off:
# Xvfb :99 -ac
Now you need to ensure that your display is set to 99 before running the Selenium server (which itself launches the browser). The easiest way to do this is to export DISPLAY=:99 into the environment for Selenium. First, make sure things are working from the command line like so:
$ export DISPLAY=:99
$ firefox
or just
$ DISPLAY=:99 firefox
Below there is a link that helped me
http://www.alittlemadness.com/2008/03/05/running-selenium-headless/