Sahi Pro - Sahi Integration Support

Sahi can be integrated to external tools using some predefined URL calls to Sahi. This document provides a comprehensive step by step list of all URL calls that might be required for a complete integration with Sahi. This document is divided into various sections in order of steps you need to perform while executing a script or suite from an external tool. By modifying the parameters in the page, you can generate a URL for your environment.

Set Sahi Server

By default Sahi server runs on localhost:9999. In case you are using a Sahi server from another machine, modify the host and port accordinglly and click on Update button.

Host: Port:

Get Script Directory

To get the script path specified in the sahi.properties file, you can use the following Request URL. You will get the scripts path as response as shown below.

Request Url:
Response:

Get All Scripts Path In The Given Directory

To get the full path for all the scripts in a given directory, you can use a request URL like this:

http://localhost:9999/_s_/dyn/ControllerUI_scriptsListJSON?suites=true&dir=<sahipro_installed_path>/userdata/scripts/
You will get an array containing the paths of all the scripts in the directory.

Name
Description
Value
suites
If set to true, suite paths will be fetched as well. To ignore suites, set it as false.
dir
Directory Path from which the scripts will be fetched. Example: E:/sahi_pro_g/userdata/scripts/

Request Url:
Response:

Get All Available Browsers

To get the list of browsers available to Sahi, you can use the following request URL. The response ia an array with names of all browsers.

Request Url:
Response:

Running the Script/Suite

To execute a suite or script, you can use a URL like this:

http://localhost:9999/_s_/dyn/Suite_start?a=a&port=9999&useSingleSession=false
	&host=localhost&test=<sahipro_installed_path>/userdata/scripts/demo/small.suite
	&threads=5&logsInfo=&suitePath=<sahipro_installed_path>/userdata/scripts/demo/small.suite&isSingleSessionS=false
	&baseURL=http://sahi.co.in/demo/&browserType=chrome&userDefinedId=11June2014__15_40_21_591

Name
Description
Value
host
Hostname(IP address) of the server where Sahi is running. Example: localhost
port
Port on which Sahi is running.Example: 9999
threads
Number of simultaneous browser instances that can be executed. Example: 3
isSingleSessionS
If "true", runs all scripts in a single browser without closing it between scripts. Example: false
browserType
Browser on which scripts will be executed. Example: chrome
suitePath
Example : C:/sahi_pro_g/userdata/scripts/demo/small.suite
baseURL
Sets a default Start URL for scripts. Example: http://sahi.co.in/demo/
userDefinedId
The unique id that the user can pass to differentiate a suite from other. You can click on 'Generate Id' button to generate a unique id.


Click on Generate Url button below to generate the request URL as per the values set in the above table. Click on Test button to execute the script.

Request Url:

Check the status of Script/Suite


A script or suite can have four types of status, INITIAL, RUNNING, SUCCESS and FAILURE. To get the current status of a script or suite under execution, you can use a URL like this:

http://localhost:9999/_s_/dyn/Suite_status?s&userDefinedId=11June2014__15_40_21_591


Name
Description
Value
userDefinedId
The unique id that the user can pass to differentiate a suite from other. Example : 11June2014__17_42_33_647

Click on Generate URL button below to get the request URL which will check the status of script/suite identified by the user defined id provided above. Click on Test to check the status.

Request Url:
Response:

Get the Suite logs

To get the logs for a suite, you can use a URL like this:

http://localhost:9999/_s_/dyn/pro/DBReports_suiteReport?userId=10June2014__12_11_22_287&type=xml

Name
Description
Value
userDefinedId
The unique id that the user can pass to differentiate a suite from other. Example: 10June2014__12_11_22_287
type
Response type of URL. This is the type of logs you want. Example: xml

Click on the Generate URL below to get the request URL for the user defined id used above. Click on Test button to get the response which also contains all the script Ids. Click on Get Ids button to get the script Ids from the suite log.

Request Url:
Response:
Script Ids
Get scriptIds from XML :

Get the Script Log

To get the logs for a script, you can use a URL like this:
http://localhost:9999/_s_/dyn/pro/DBReports_scriptReport?id=10June2014__12_11_22_287&type=xml

Name
Description
Value
id
The unique id that differentiate a script from other. Example: 10June2014__12_11_22_287
type
Response type of URL. This is the type of logs you want. Example: xml

Click on the Generate URL below to get the request URL for the user defined id used above. Click on Test button to get the response, which is the logs for the script run.

Request Url:
Response: