views:

182

answers:

1

I'm setting up to cron a web scraping job, using xvfb, firefox, and watir on my Mac OS X.

In testing the script so far, firefox pops up visibly on the local desktop, the watir script executes, and then firefox exits (I quit firefox in my script).

I'd like to set the xvfb DISPLAY such that firefox will run, but won't be seen on the local desktop, running 'in the background' so to speak.

Nothing I've been able to find online discusses such a possibility - nor explains that it's not possible.

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

A: 

This is what we use to build packages whose testsuite require running Xserver in 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 in OSX also uses X11 of course).

duncan
Cool! It definitely does use X11.I'm off to a meeting. Have to wait to prove that it works until after.
marfarma