Sahi Documentation

Sahi headless execution with Mozilla Firefox

warning NOTE: We do not recommend headless execution. Troubleshooting scripts in a headless environment can be tricky. In many cases, failures happen in headless which do not happen in real browsers. Troubleshooting and fixing them may not be worthwhile since your customers are using real browsers.
warning If you are looking at headless execution for integration with your CI server, read our recommended Jenkins/CI setup without headless playback.
infoCaution: Headless mode is available on Mac and Linux in Firefox 55+. Windows support is coming in Chrome 56+. (A headless browser runs without a user interface) To check what version of Firefox Type about:support in the URL and hit enter. You should see a page titled Troubleshooting Information, which displays the version number underneath Application Basics.

For Windows:

  1. Download latest version of Mozilla Firefox from https://www.mozilla.org/en-US/firefox/new/
  2. Click "Configure" link on Dashboard, and, add
  3. <browserType>
    	<name>firefoxHL</name>
    	<displayName>firefoxHL</displayName>
    	<icon>firefox.png</icon>
    	<path>$ProgramFiles\Mozilla Firefox\firefox.exe</path>
    	<options>-profile "$userDir/browser/ff/profiles/sahi$threadNo" -no-remote -headless</options>
    	<processName>firefox.exe</processName>
    	<capacity>5</capacity>
    </browserType>
  4. Save and restart Sahi.
  5. To run a test in Firefox headless: Click on "Bin" on the dashboard (or navigate to sahi/userdata/bin on a command prompt) and run the command
  6. testrunner.bat sahitests/sahi_demo.sah http://sahi.co.in/demo/ firefoxHL

For Linux:

  1. To check Firefox version, Open terminal and type (without quotes): "firefox --version" or "firefox -v" and it must appear Mozilla Firefox 55, or above.
  2. Click "Configure" link on Dashboard, and, if not present, add
  3. <browserType>
    	<name>firefoxHL</name>
    	<displayName>firefoxHL</displayName>
    	<icon>firefox.png</icon>
    	<path>/usr/bin/firefox</path>
    	<options>-profile "$userDir/browser/ff/profiles/sahi$threadNo" -no-remote -headless</options>
    	<processName>firefox</processName>
    	<capacity>5</capacity>
    </browserType>
  4. Save and restart Sahi.
  5. To run a test in Firefox headless: Open terminal, navigate to sahi/userdata/bin and run the command
  6. sh testrunner.sh sahitests/sahi_demo.sah http://sahi.co.in/demo/ firefoxHL

For Mac:

  1. To check Firefox version, Open terminal and type (without quotes): "firefox --version" or "firefox -v" and it must appear Mozilla Firefox 55, or above.
  2. Click "Configure" link on Dashboard, and, if not present, add
  3. <browserType>
    	<name>firefoxHL</name>
    	<displayName>FirefoxHL</displayName>
    	<icon>firefox.png</icon>
    	<path>open -n -a Firefox.app</path>
    	<options>--args -profile "$userDir/browser/ff/profiles/sahi$threadNo" -no-remote -headless</options>
    	<processName>Firefox</processName>
    	<capacity>5</capacity>
    	<force>true</force>
    </browserType>
  4. Save and restart Sahi.
  5. To run a test in Firefox headless: Open terminal, navigate to sahi/userdata/bin and run the command
  6. sh testrunner.sh sahitests/sahi_demo.sah http://sahi.co.in/demo/ firefoxHL
This will run the Sahi script without opening a browser.