Search code examples
macossafarixvfbheadless-browserjs-test-driver

Run Safari browser headlessly using xvfb on Mac


How do I run my jstestdriver test cases headlessly on Safari browser on OSX platform? I am able to achieve the same on Linux by using xvfb-run command. However, there is no such wrapper command available in OSX. I tried executing the following 2 commands and then executing my testcases in safari.

Xvfb :99 -ac &
export DISPLAY=:99

However, by Safari browser shows up instead of running in xvfb environment. It seems like Safari ignores the DISPLAY command completely. Is there a way I can run Safari headlessly on OSX?


Solution

  • Mac OS X does not use X11 as the display server for native applications. As such, Xvfb is not applicable, and setting DISPLAY has no effect.

    Mac OS applications cannot generally be run in the same sort of "headless" environment you're imagining here. Some applications, such as Vine Server, could do this in the past, but they appear to have stopped working under Mac OS 10.8 and later.