Skip to content
Sahi Pro Flowcharts is retired. These pages document the last release (v12) and are no longer updated. Go to the current documentation.Flowcharts is retired. Current docs
Get Free Trial
Sahi Pro Flowcharts is retired. These pages document the last release (v12) and are no longer updated. Go to the current documentation.

Documentation APIs

Sahi As Documentation Tool describes how to create documentation while recording a new Sahi script. But what if we wanted to create documentation for previously created scripts? Sahi's Documentation APIs allow you to do just that. Use the _startDocumentation and _stopDocumentation APIs in your script, and execute the script to create documentation with screenshots.

Modes BrowserWindowsJavaAndroidiOSSAP

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

Parameters

NameTypeDescription
$filepathstringFile path of the output Sahi script containing documentation with screenshots. Relative path resolves relative to files folder of the current project.
$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. Relative path resolves relative to files folder of the current project. 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.
Raw script
_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"));

Sahi Pro Classic API _startDocumentation

Modes BrowserWindowsJavaAndroidiOSSAP

Stop Documentation will stop the documentation.

Parameters

NameTypeDescription
None
Raw script
_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"));

Sahi Pro Classic API _stopDocumentation