Skip to content
Get Free Trial

Documentation Functions

Create documentation with screenshots from existing scripts: use the _startDocumentation and _stopDocumentation functions in your script, and run it.

Since
Sahi Pro 6.0.0
Desktop Engine 7.0.0
Mobile Engine 7.5.0
SAP Engine 9.0.0

Modes BrowserWindowsJavaAndroidiOSSAP

_startDocumentation($filepath[, $overwrite[, $refFile]])

Arguments

NameTypeDescription
$filepathstringFile path of the output Sahi script containing documentation with screenshots.
$overwritebooleanoptionalIf true, overwrites content. Default is false, which appends at the end of existing content.
$refFilestringoptionalFile path of the reference sahi document script. This parameter will change the Sahi document's description and screenshots accordingly. The modification to this file will work as the reference to the next version of the document. To create the reference file, do the following,

1. If you have recorded the script in documentation mode, export this doc file as HTML and use it as a reference file.

2. If you have not recorded the script in documentation mode, use the below statement in your script,
_startDocumentation("sourceFile.sah", true);
This will create sourceFile.sah (script with documentation and screenshots) on first playback. Use this as your reference file.

Returns

null

_startDocumentation starts the documentation. All steps after this line will be documented until a _stopDocumentation call is made.

_focusWindow();
// This is needed since we need screenshots of the application window.
_startDocumentation("doc.sah", true, "reference_doc.sah");
// doc.sah is the desired output script that contains the documented Sahi steps with screenshots.
_navigateTo("http://sahi.co.in/demo/training/");
_setValue(_textbox("user"), "test");
_setValue(_password("password"), "secret");
_click(_submit("Login"));
_assertVisible(_textbox("total"));
_stopDocumentation(); // Documentation stopped
_click(_button("Logout"));
Since
Sahi Pro 6.0.0
Desktop Engine 7.0.0
Mobile Engine 7.5.0
SAP Engine 9.0.0

Modes BrowserWindowsJavaAndroidiOSSAP

_stopDocumentation()

Arguments

NameTypeDescription
None

Returns

null

_stopDocumentation will stop the documentation.

_startDocumentation("doc.sah"); //Documentation started
_navigateTo("http://sahi.co.in/demo/training/");
_setValue(_textbox("user"), "test");
_setValue(_password("password"), "secret");
_click(_submit("Login"));
_assertVisible(_textbox("total"));
_stopDocumentation(); // Documentation stopped
_click(_button("Logout"));