I am running selenium through Xvfb on display number :99 like this:
/usr/bin/Xvfb :99 -ac -screen 0 1024x768x8 & export DISPLAY=":99" && java -jar /usr/lib/selenium/selenium-server-standalone-2.24.1.jar -port 4444
However display with number other than :0 is not visible by default. How do I make it visible to actually see what selenium is doing in the browser?
It's virtual. From the man page
Xvfb(1)
:Also in the man page:
All you need is to install
x11vnc
via:Optionally install fluxbox to have simple window manager.
Then to setup access to Xvfb for remote control, you can use X11 over SSH or VNC over SSH, e.g.
Here is script friendly version:
Note: I'm using it in the following Docker project (check
.funcs.cmds.inc.sh
).If your Xvfb listen on localhost only, you can setup tunneling to localhost, so a vncviewer can then connect to localhost to get remote control over the server. E.g.
Or to listen on all addresses with password, use:
To setup password, run:
x11vnc -storepasswd
.See: Remote control over SSH at Xvfb Wikipedia page
Or you can use the following one-liner:
-create
makes it start XvfbX11VNC_FINDDISPLAY_ALWAYS_FAILS=1
makes it goto the created Xvfb session (Display:1
rather than:0
which will be normal desktop)FD_PROG=/usr/bin/fluxbox
makes it fire up Fluxbox (Ubuntu's one, should have background Ubuntu logo)X11VNC_CREATE_GEOM=${1:-1024x768x16}
sets screen to 16bit colour 1024x768-gone
cleans up when it exits as otherwise Xvfb is left behind (killingxvfb
also killsfluxbox
)Check also:
A simple solution is also to constantly take screenshots of the program like this:
Note: requires to install imagemagick and feh
You can get a live view by running a VNC server against the Xvfb display, like this: