Sahi Configuration (Basic)

abstract Sahi may need a few configuration tweaks to make it work on your system.

Configure Browsers in Dashboard

Sahi's Dashboard lists the browsers installed on your systems. Sahi tries to look in default installation locations of different browsers.

If a particular browser, eg. firefox, is installed but not visible on the Dashboard, do the following:
  1. Click on the All Settings button on the Dashboard. It will open up all Settings dialog.
  2. Click on the Sahi Pro Settings button. It will open up Configure Sahi Pro page. If browser_types.xml is not open, Click on browser_types.xml on the left.
  3. Look for a browserType node with <name>firefox</name>
  4. Locate the path element and change the value to what is on your machine. For example, Change
    <path>$ProgramFiles\Mozilla Firefox\firefox.exe</path>
    <path>C:\Program Files\Mozilla Firefox\firefox.exe</path>
  5. Normally, you do not need to change any other option
  6. Click Save, close the browser, restart Sahi. You should now see firefox on the Dashboard

browserType Node

    <path>$ProgramFiles\Mozilla Firefox\firefox.exe</path>
    <options>-profile "$userDir/browser/ff/profiles/sahi$threadNo" -private-window -purgecaches -no-remote</options>

nameKey by which this browserType will be referred. This can be any value without spaces.
displayNameText displayed on the Dashboard
iconIcon to be displayed. These are bundled inside Sahi
pathPath to the browser executable. If you run this from a command line, it should invoke the browser
optionsBrowser startup options. Sahi launches browsers with some preconfigured settings like proxy, cookie isolation, SSL etc. using the options. There are specific settings for different browsers and should not be modified by the user. Internet Explorer 8+

Internet Explorer 6,7 options tag needed but is blank
<options> </options>

<options>-profile "$userDir/browser/ff/profiles/sahi$threadNo" -private-window -purgecaches -no-remote</options>

Google Chrome
<options>--no-default-browser-check --user-data-dir=$userDir\browser\chrome\profiles\sahi$threadNo --proxy-server=$port
--disable-popup-blocking --always-authorize-plugins --allow-outdated-plugins --enable-npapi --incognito</options>

Safari options tag needed but is blank
<options> </options>

Opera options tag needed but is blank
<options> </options>

<options>--proxy=$port $userDir\..\ext\phantomjs\phantomsahi.js</options>

processNameProcess name for looking up PID of process. Sahi will do a tasklist or ps with this name to identify the process to kill
capacityMaximum number of browsers simultaneously executable without overwhelming the system. This depends on your system and you can configure this based on your judgement
useSystemProxytrue/false. Specifies if Windows system proxy settings should be changed to use Sahi Proxy. Needed by Internet Explorer and Safari on Windows
forcetrue/false. Sahi checks to see that the path attribute above is correct and available on the system. On some Operating Systems the path is not really a file path but a command to invoke the browser. Use force=true in those cases

Variables used in browser_types.xml

$userDirPath to Sahi's userdata directory
$threadNoDo not modify. Sahi dynamically substitutes this value during playback.
$XXXSahi looks for a System environment property of name XXX and replaces its value. For example, $ProgramFiles will be replaced with C:\Program Files on Windows

Other browser modifications needed

infoTo work with pop-up windows, make sure that browser pop-up blockers are disabled

Internet Explorer 11

  1. Disable "Enable Protected Mode"

Internet Explorer 10

While running scripts on Internet Explorer 10, if you face the below error

then make following changes

  1. Click on the Configure link on the Dashboard. It will open up Sahi's configuration page.
  2. Click on the link on the left panel. It will open up Sahi's userdata properties on right panel.
  3. Write below code at end of userdata properties.
    1000 is the time delay in milliseconds. You can increase this delay if problem still persists.
  4. Click Save
  5. Restart Sahi.


Opera needs to be configured slightly so that crash-recovery and splash screens are disabled. On Opera 18.0
  1. On Opera, type opera:config in the url bar to edit configuration. select Open a specific page or set of pages and Set pages should be blank.
On older versions of Opera On Opera, type opera:config in the url bar to edit configuration. Modify the configuration: set Recovery Strategy = 0 and Uncheck Show Problem Dialog


You can only run Safari in one thread if you want it to be killed properly. Also make sure no other Safari instances are running before you invoke this. Other wise new pages may open in tabs.

Configure SSL

Sahi acts as a proxy between the browser and website. For SSL sites, this means that Sahi behaves like a man in the middle. To make Sahi work properly on SSL sites, a particular Sahi root certificate needs to be accepted.

Sahi allows various methods to accept the root certificate
  1. Click on the All Settings button on Sahi's Dashboard.It will open all Settings dialog.
  2. Click on the SSL button. Sahi will try to use certutil on Windows to add the root certificate. This will work if you have the correct privileges. If it succeeds you will see something like this on your Sahi console.
  3. If step 1 does not succeed automatically, a security window will be opened. Click Yes to accept the certificate.
  4. If step 2 does not work either, then a different screen would popup. Follow these steps.

Enabling weaker algorithms on Java 1.7 and later

symptom When connecting to a specific https site, any browser opened from the Sahi Dashboard fails to connect, with an error message Received fatal alert: handshake_failure. Sahi can not connect to the desired URL.
resolution Check if you are able to connect to via Sahi.

If you could access, but not your other sites, it is possible that these servers have certificates with a weaker algorithm. To fix it, do the following:
  1. See what your java path is from the Controller->Info tab. You should see something like this:
    Java Installed Directory: D:\Dev\Programs\jdk7\jre
  2. Open <jre_dir>/lib/security/ file in a text editor. (In our case, it is D:\Dev\Programs\jdk7\jre\lib\security\
  3. Look for jdk.certpath.disabledAlgorithms. In our case, it looks like:
  4. Comment it out, so that it looks like this:
  5. Restart Sahi, and check again.

For Linux

For Mac

For Mobile Device

External Proxy

If you normally need a proxy to access websites, you will have to tell Sahi to use that proxy. You configure the external proxy by editing /userdata/config/ and setting these properties:

Proxy AutoConfig Script

If you normally use a proxy pac file, you need to tell Sahi to use it. To check, go to Internet Explorer -> Tools -> Internet Options -> Connection -> LAN Settings The value in Address is what we want.

Open and add
# Replace http://autoconfig/proxy.pac with your relevant proxy URL

If the Address looks like

infoIf directly specifying the proxy.pac URL does not work,
  1. Open a browser without Sahi. Navigate to the proxy.pac URL, download and save it on the filesystem, say as C:/proxy.pac
  2. Use ext.http.proxy.pac.url=C:/proxy.pac

Fixed Proxy

Check if you normally use a fixed proxy If yes, modify like this:
If your proxy needs authorization, you should set these properties too.
You should do the same with ext.https settings for https sites. In addition, if you need to bypass the external proxy for some local sites you need to configure that too in like this
Note that there is only one bypass setting for both http and https.

Configuring Proxy on Mac

Sahi automatically configures the proxy on Mac before launching a browser. Sahi assumes that your default networkserviceorder is Wi-Fi If it is something else, eg. AirPort, you need to add
to Restart Sahi and check.

Depending on your Mac version, you may see a prompt to enter username/password like this: You need to disable this prompt using one of the ways specified at this link: osx - Prevent networksetup from asking password - Stack Overflow.

If Safari is opening more than one window while running the Sahi script than follow solution given here How to stop Safari reopen on last page - Apple Communities

Configure VPN proxy settings