xvfb on a machine with a display, can an application run 'in the background?'
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 t开发者_如何学Pythonhe 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?
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).
there's a gem called Headless for this kind of stuff. I've tried it with Selenium in my Ubuntu and works fine.
精彩评论