Using Selenium with a virtual framebuffer

I needed to run my Selenium tests on a virtual machine, on RedHat Enterprise Linux 6.6 in a multi-screen environment and this messed up the screenshots that the tests took. Virtual frame buffer to the rescue:

First I had to install it,

wget http://vault.centos.org/6.2/os/x86_64/Packages/xorg-x11-server-Xvfb-1.10.4-6.el6.x86_64.rpm

sudo yum localinstall xorg-x11-server-Xvfb-1.10.4-6.el6.x86_64.rpm 

then I could start it,

Xvfb :1 -screen 5 1024x768x8 &

make that terminal session use it,

export DISPLAY=:1.5

and I could finally run my tests, with the screenshots working fine.