Xvfb on a machine with a display, can the application run "in the background?"

I am setting up to clean my web pages using xvfb, firefox and watir on my Mac OS X.

When testing the script, firefox is still visible on the local desktop, the watir script is executed, and then firefox exits (I exit firefox in my script).

I would like to install xvfb DISPLAY in such a way that firefox starts, but will not appear on the local desktop, so to speak, in the background.

Nothing that I managed to find on the Internet does not discuss this possibility - and does not explain that it is impossible.

Is it possible? If so, what do I need to do to make it work?

+3
source share
2 answers

This is what we use to create packages whose testuite requires running Xserver on Linux:

#############################################
### Launch a virtual framebuffer X server ###
#############################################
export DISPLAY=":98"
Xvfb $DISPLAY >& Xvfb.log &
trap "kill $! || true" EXIT
sleep 10
...
# start your application/testsuite here

I tried it with firefox in a script. And does what you need (if your firefox on OSX also uses X11, of course).

+4
source

there is a gem called Headless for this kind of thing. I tried this with Selenium in my Ubuntu and it works great.

+1
source

Source: https://habr.com/ru/post/1744201/


All Articles