Sahi Pro - Script Suite Info APIs
_scriptName
_scriptName()
Arguments
None |
Details
Returns the script name.
Returns the script name.
// In script D:/sahi/userdata/scripts/demo/check.sah
var $scriptName = _scriptName(); // returns "check.sah"
_scriptPath
_scriptPath()
Arguments
None |
Details
Returns the full script file path.
Returns the full script file path.
// In script D:/sahi/userdata/scripts/demo/check.sah
var $_scriptPath = _scriptPath(); // returns "D:/sahi/userdata/scripts/demo/check.sah"
_userDataPath
_userDataPath($relPath)
Arguments
$relPath | string | Path to resolve relative to userdata path |
Details
Returns full file path of file resolved relative to userdata directory
Returns full file path of file resolved relative to userdata directory
// 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
_resolvePath
_resolvePath($relPath)
Arguments
$relPath | string | Path to resolve relative to current script path |
Details
Returns full file path of file resolved relative to current script path
Returns full file path of file resolved relative to current script path
/*
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
_sessionInfo
_sessionInfo()
Arguments
None |
Details
Returns information about the current session as an associative array.
The object has attributes:
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
_suiteInfo()
Arguments
None |
Details
Returns suite information as an associative array.
The object has properties:
Returns suite information as an associative array.
The object has properties:
- suiteName: name of suite
- suitePath: Path of suite
- base: Base url for suite
- browser: Browser executable path
- browserOption: browserOption passed to Suite
- browserProcessName: browserProcessName passed to Suite
- sessionId: SessionId of suite
var $suiteInfo = _suiteInfo();
var $name = $suiteInfo["suiteName"];
// or
var $name = $suiteInfo.suiteName;