How to set up a Headless Selenium Testing environment for CentOS 6.3.
Follow these steps to set up a CentOS 6.3 host to run headless Selenium tests with Firefox.
sudo yum -y install firefox Xvfb libXfont Xorgsudo yum -y groupinstall "X Window System" "Desktop" "Fonts" "General Purpose Desktop"(installation takes a few minutes)- Launch an XWindows Virtual Frame Buffer(XVFB) session on display port 99:
Xvfb :99 -ac -screen 0 1280x1024x24 & - Tell all XWindows applications in this terminal session to use the new Xvfb display port:
export DISPLAY=:99 - Start the Selenium server, eg:
java -jar /opt/selenium-server-standalone.jar & - Now start your Selenium tests. The Selenium server should spawn a headless Firefox instance and your tests should run successfully.
How to install an XWindows terminal so that you can connect to your CentOS 6.3 host and run your Selenium tests in a graphical Web browser. This capability will be invaluable whenever you need to debug Selenium tests on one of your remote hosts.
- First you need X11 or XQuartz. If you have an older version of Mac OS X then X11 should already be installed.
- If you are running Mountain Lion (OS X 10.8) or newer, then you can download XQuartz here: http://xquartz.macosforge.org/landing/
- Open XQuartz and ssh to your CentOS host using the
-Xoption, eg:ssh -X user@example.com - On the remote host, type
export DISPLAY=localhost:10.0 - Type
firefoxand after a long pause you should see Firefox start up. - Now if you start the selenium server in this terminal session, you will see Firefox start up when you run your tests.
Note that it's much slower to execute the tests under XWindows.
- http://alexbischof.blogspot.com/2012/11/centos-installing-graphical-x-window.html
- http://blog.kabisa.nl/2010/05/24/headless-cucumbers-and-capybaras-with-selenium-and-hudson/
- http://stackoverflow.com/questions/8817196/problems-with-bundling-xvfb-into-application
- http://xquartz.macosforge.org/trac/wiki/X11-UsersFAQ
- http://www.infoworld.com/t/platforms/how-connect-remote-x11-hosts-mac-616
- http://rampagedreality.com/post/904335189/paul-harckham-has-his-x-wing-fine-art-print-up

How is that headless? You install the whole graphical environment!