Hide your Selenium browser window with a VNC server
This is now part of geordi. Please don't follow the instructions below, if you use geordi.
Inspired by the recent headless Selenium note, I found yet another solution for the problem to hide your selenium tests away.
This has the advantages
- not to require a gem (so you do not force this on others)
- to allow you to take a look at the running webdriver if necessary
Simply make a script that runs your cucumber tests and runs this before:
vncserver :6 -localhost -nolisten tcp -SecurityTypes None &>/dev/null DISPLAY=":6"
Your webdriver will now start within a VNC server (which will only listen to your machine). To take a look, open a VNC viewer using
You can close the viewer, and the tests will keep running.
The X session provided by the VNC server can have a custom resolution. Just pass your preferred resolution like this:
You need a VNC server and viewer:
sudo apt-get install tightvncserver sudo apt-get install xtightvncviewer sudo apt-get install vnc4server # alternative vncserver if tightvncserver doesn't work
Also on Ubuntu you are asked for a password the first time you start the VNC server. It will not be used by the above call after that (due to
So for a first-time setup run it without the "
&>/dev/null" part, choose a password, and terminate your vnc server.
vncserver -kill :6