Script Suite Info APIs

_scriptName

Since: Sahi ProDesktop Add-OnMobile Add-OnSAP Add-OnAI Assist Add-On
3.57.0.07.5.09.0.0NA

Available for modes: Browser | Windows | Java | Android | iOS | SAP

_scriptName()

Arguments
None

Returns
stringScript name

Sahi Pro Flowcharts Action :Script Name

Details

// In script D:/sahi/userdata/scripts/sahitests/check.sah
var $scriptName = _scriptName(); // returns "check.sah"


_scriptPath

Since: Sahi ProDesktop Add-OnMobile Add-OnSAP Add-OnAI Assist Add-On
3.57.0.07.5.09.0.0NA

Available for modes: Browser | Windows | Java | Android | iOS | SAP

_scriptPath([$fileSeparator])

Arguments
$fileSeparatorstring optional To get full script file path with specified file separator. Can be one of "\\" or "/" Defaults to "/"

Returns
stringFull script file path

Sahi Pro Flowcharts Action :Script Path

Details

// In script D:/sahi/userdata/scripts/sahitests/check.sah
var $_scriptPath = _scriptPath(); // returns "D:/sahi/userdata/scripts/sahitests/check.sah"
var $_scriptPath = _scriptPath("\\"); // returns "D:\sahi\userdata\scripts\sahitests\check.sah"


_scriptStartTime

Since: Sahi ProDesktop Add-OnMobile Add-OnSAP Add-OnAI Assist Add-On
4.37.0.07.5.09.0.0NA

Available for modes: Browser | Windows | Java | Android | iOS | SAP

_scriptStartTime()

Arguments
None

Returns
objectScript start time as a Date object

Sahi Pro Flowcharts Action :Script Start Time

Details

danger In versions prior to 6.0.0, it returned a String. Scripts written before 6.0.0 will need changes.
var $dateObj = _scriptStartTime();
# Detailed usage:
var $date = $dateObj.toString();
var $year = $dateObj.getFullYear();
var $month = $dateObj.getMonth(); // Month range 0-11
var $month = $dateObj.getMonth2(); // Month range 1-12
var $day = $dateObj.getDay();
var $hours = $dateObj.getHours();
var $minutes = $dateObj.getMinutes();
var $seconds = $dateObj.getSeconds();


_scriptStatus

Since: Sahi ProDesktop Add-OnMobile Add-OnSAP Add-OnAI Assist Add-On
3.57.0.07.5.09.0.0NA

Available for modes: Browser | Windows | Java | Android | iOS | SAP

_scriptStatus()

Arguments
None

Returns
string 'SUCCESS' or 'FAILURE'

Sahi Pro Flowcharts Action :Script Status

Details



_scriptInfo

Since: Sahi ProDesktop Add-OnMobile Add-OnSAP Add-OnAI Assist Add-On
9.2.09.2.09.2.09.2.0NA

Available for modes: Browser | Windows | Java | Android | iOS | SAP

_scriptInfo()

Arguments
None

Returns
objectScript object

Sahi Pro Flowcharts Action :Script Info

Details

Returns script information as an associative array. One of the properties in the array is:
  • browserVersion: Browser version on which script is running
  • userAgent: Browser User-Agent on which script is running
  • infoNOTE: userAgent added Since Sahi Pro: 11.0.0
var $scriptInfo = _scriptInfo();
var $browserVersion = $scriptInfo["browserVersion"];
// or
var $name = $scriptInfo.browserVersion;


_addToScriptInfo

Since: Sahi ProDesktop Add-OnMobile Add-OnSAP Add-OnAI Assist Add-On
9.2.09.2.09.2.09.2.0NA

Available for modes: Browser | Windows | Java | Android | iOS | SAP

_addToScriptInfo($customFieldName, $customFieldValue)

Arguments
$customFieldNamestring Name of the Custom Field.
$customFieldValuestring Value of the Custom Field.

Returns
null

Sahi Pro Flowcharts Action :Add To Script Info

Details

Appends the customFieldName and customFieldValue in Script Info.

_addToScriptInfo("summary", "Login - Regression Testing");


_userDataDir

Since: Sahi ProDesktop Add-OnMobile Add-OnSAP Add-OnAI Assist Add-On
3.57.0.07.5.09.0.0NA

Available for modes: Browser | Windows | Java | Android | iOS | SAP

_userDataDir([$fileSeparator])

Arguments
$fileSeparatorstring optional To get path with specified file separator. Can be one of "\\" or "/" Defaults to "/"

Returns
stringFull file path of userdata directory

Sahi Pro Flowcharts Action :User Data Dir

Details

$userDataPath = _userDataDir(); // returns "D:/sahi/userdata"
$userDataPath = _userDataDir("\\"); // returns "D:\sahi\userdata"


_userDataPath

Since: Sahi ProDesktop Add-OnMobile Add-OnSAP Add-OnAI Assist Add-On
3.57.0.07.5.09.0.0NA

Available for modes: Browser | Windows | Java | Android | iOS | SAP

_userDataPath($relPath[, $fileSeparator])

Arguments
$relPathstring Path to resolve relative to userdata path
$fileSeparatorstring optional To get path with specified file separator. Can be one of "\\" or "/" Defaults to "/"

Returns
stringFull file path of file resolved relative to userdata directory

Sahi Pro Flowcharts Action :User Data Path

Details

// If you have a data/excelsheets folder in sahi/userdata folder,
// you can access it using
$excelDataPath = _userDataPath("data/excelsheets"); // returns "D:/sahi/userdata/data/excelsheets"
$excelDataPath = _userDataPath("data/excelsheets", "\\"); // returns "D:\sahi\userdata\data\excelsheets"


_resolvePath

Since: Sahi ProDesktop Add-OnMobile Add-OnSAP Add-OnAI Assist Add-On
3.57.0.07.5.09.0.0NA

Available for modes: Browser | Windows | Java | Android | iOS | SAP

_resolvePath($relPath[, $fileSeparator])

Arguments
$relPathstring Path to resolve relative to current script path
$fileSeparatorstring optional To get path with specified file separator. Can be one of "\\" or "/" Defaults to "/"

Returns
stringFull file path of file resolved relative to current script path

Sahi Pro Flowcharts Action :Resolve Path

Details

/*
If the current script is
D:/sahi/userdata/scripts/user/login.sah
If you have common csv file in
D:/sahi/userdata/scripts/common/user.csv
*/
// using
$csvPath = _resolvePath("../common/user.csv"); // returns "D:/sahi/userdata/scripts/common/user.csv"
$csvPath = _resolvePath("../common/user.csv", "\\"); // returns "D:\sahi\userdata\scripts\common\user.csv"


_sessionInfo

Since: Sahi ProDesktop Add-OnMobile Add-OnSAP Add-OnAI Assist Add-On
3.57.0.07.5.09.0.0NA

Available for modes: Browser | Windows | Java | Android | iOS | SAP

_sessionInfo()

Arguments
None

Returns
objectCurrent session object

Sahi Pro Flowcharts Action :Session Info

Details

Returns information about the current session as an associative array. The object has attributes:

  • isRecording: returns true if recording
  • isPlaying: returns true if playingback
  • isPaused: returns true if playback is paused
  • sessionId: returns Sahi's sessionId
  • threadNumber: returns the threadNumber of browser instance running
  • scriptPath: returns script path of current script. Same as _scriptPath()
var $sessionInfo = _sessionInfo();
var $sessionId = $sessionInfo["sessionId"];
// or
var $sessionId = $sessionInfo.sessionId;


_suiteInfo

Since: Sahi ProDesktop Add-OnMobile Add-OnSAP Add-OnAI Assist Add-On
3.57.0.07.5.09.0.0NA

Available for modes: Browser | Windows | Java | Android | iOS | SAP

_suiteInfo()

Arguments
None

Returns
objectSuite object

Sahi Pro Flowcharts Action :Suite Info

Details

Returns suite information as an associative array. Some of the properties in the array are:
  • suiteReportId: The suite report id for the suite/script run
  • suiteName: Name of suite/script
  • suitePath: Path of suite/script
  • baseURL: Base url for suite/script run
  • browserType: Browser that the suite/script was run on
var $suiteInfo = _suiteInfo();
var $name = $suiteInfo["suiteName"];
// or
var $name = $suiteInfo.suiteName;


_addToSuiteInfo

Since: Sahi ProDesktop Add-OnMobile Add-OnSAP Add-OnAI Assist Add-On
6.2.07.5.07.5.09.0.0NA

Available for modes: Browser | Windows | Java | Android | iOS | SAP

_addToSuiteInfo($customFieldName, $customFieldValue)

Arguments
$customFieldNamestring Name of the Custom Field.
$customFieldValuestring Value of the Custom Field.

Returns
null

Sahi Pro Flowcharts Action :Add To Suite Info

Details

Appends the customFieldName and customFieldValue in Suite Info.

_addToSuiteInfo("VersionNo", "6.1.1");


_testcasesInfo

Since: Sahi ProDesktop Add-OnMobile Add-OnSAP Add-OnAI Assist Add-On
6.1.07.0.07.5.09.0.0NA

Available for modes: Browser | Windows | Java | Android | iOS | SAP

_testcasesInfo()

Arguments
None

Returns
array of objectsArray of testcase-property objects of the testcases in the script that have already been executed

Sahi Pro Flowcharts Action :Testcases Info

Details

A testcase-property is an associative array with the following attributes:
  • id: testcase Id, Unique identifier for testcase
  • description: Description for testcase
  • status: Execution status of the testcase
  • timeTaken: Time taken for testcase execution
var $tcs = _testcasesInfo();
for(var $i=0; $i<$tcs.length; $i++){
  var $tc = $tcs[$i];
  _log("id = " + $tc.id + "; description = " + $tc.description + "; status = " + $tc.status + "; timeTaken = " + $tc.timeTaken + ";");
}


_isDataPassed

Since: Sahi ProDesktop Add-OnMobile Add-OnSAP Add-OnAI Assist Add-On
5.1.07.0.07.5.09.0.0NA

Available for modes: Browser | Windows | Java | Android | iOS | SAP

_isDataPassed()

Arguments
None

Returns
booleantrue if data has been passed via a dd.csv data driven suite, else false

Sahi Pro Flowcharts Action :Is Data Passed

Details

More details here