5

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?

0
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.
4
  • 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 virtual frame buffer" (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 5 '16 at 19:34
  • (it could be any port, but @mweppler seems to be a leet person :-) ) – chesterbr May 5 '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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.