6

I'm trying to run SlimerJS in headless mode so that it does not open a visible browser window on Mac OSX.

According to the SlimerJS docs, this can be done using xvfb which is "available on Linux and MacOS", using the command:

>> xvfb-run ./slimerjs myscript.js.

Although OSX comes with bundled with xvfb, it does not have the corresponding xvfb-run script.

How can I get the same functionality using the OSX xvfb version?

Adi Shavit
  • 477
  • 3
  • 6
  • 17

1 Answers1

5

You can try something like the following (works for me with running my python test cases):

$ Xvfb :1337 & export DISPLAY=:1337 & ./slimerjs myscript.js.
mweppler
  • 51
  • 2
  • 5
    Will be good if you can provide some explanation of what this command will do. – VL-80 Aug 26 '15 at 20:57
  • 1
    Not an `xvfb` expert, but `Xvfb :1337` starts an "*x*-window *v*irtual *f*rame *b*uffer" (xvfb), which will pretend to be a window server, but will not write anything to a screen) listening on port 1337; `export DISPLAY=:1337` sets the `DISPLAY` env variable to that same port number - so X applications send their screen commands to that port; `./slimerjs mysript.js` calls the application, which will believe to be writing on the screen, running headless as we want. – chesterbr May 05 '16 at 19:34
  • (it could be any port, but @mweppler seems to be a [leet](https://en.wikipedia.org/wiki/Leet) person :-) ) – chesterbr May 05 '16 at 19:36
  • I think xvfb-run also kills the Xvfb process after running the process, maybe a killall xvfb at the end would be helpful ? – keisar Jan 27 '17 at 10:33