For all the many problems with X11, it's still pretty cool that you can run something as complicated as Chrome in a headless manner just by running another program (xvfb) that speaks the protocol.<p>(I keep intending to hack Blink into a state where it can run truly headless, like a library, so that hacks like the above aren't necessary.)
One thing I always think is worth mentioning in posts like this is that the above setup (and any setup using Selenium, really) is going to be <i>super</i> slow. More than one order of magnitude slow, when compared to direct HTTP requests.<p>It's only ever worth using Selenium when you <i>literally</i> can't do anything else to get your testing done.<p>Edit: Going through my bookmarks bar and found this, from 2008 - <a href="http://www.alittlemadness.com/2008/03/05/running-selenium-headless/" rel="nofollow">http://www.alittlemadness.com/2008/03/05/running-selenium-he...</a><p>Might help anyone if they run into issues.
One odd issue that I ran into was that Chrome (and Firefox) wouldn't always go fullscreen. I had to install a window manager that defaulted to fullscreen. In particular, I went with Ratpoision: <a href="http://danielwebb.us/software/ratpoison/" rel="nofollow">http://danielwebb.us/software/ratpoison/</a>
I've had good luck with a similar setup (somewhat inspired by IMVU's) doing integration testing on an Ember app: Chromium + chromedriver inside a VirtualBox Vagrant instance using Xvfb + ratpoison + x11vnc. My tests run from a modified version of Wai Yip Tung's HTMLTestRunner (Python unittest module underneath) so reloading the tests tab in a browser on my dev machine reruns the tests. All of the tests are written in Python. If something gets stuck you open up a VNC client and poke around manually. It's a bit of work to set up and the tests can be a bit slow but I'd recommend it when you really need to test in a browser.
How does it differ from PhantomJS/CasperJS (headless webkit)? I have been using these for a while and they can do pretty much everything that you can do in a browser.
I've experimented with running headless tests using Firefox, in hopes of getting a good performance boost in terms of test speed. The results actually did not indicate much of a difference. If anything, FF in headless mode on CentOS ran slower than on Windows.<p>That's not to say there aren't good use cases for running headless browsers with Selenium. One huge benefit is not needing to run Windows VMs.