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.

APIs used in Debugging Sahi Scripts

Some APIs are good for debugging Sahi scripts. They are mostly removed once debugging is done.

Modes BrowserWindowsJavaAndroidiOSSAP

Debug messages are written in the Sahi console and not in the playback logs. It is useful when correlating to messages appearing on the Sahi console.

Parameters

NameTypeDescription
$messagestringMessage to write to Sahi console
Raw script
// Example:
_debug("Current count is " + $i);

Sahi Pro Classic API _debug

Modes BrowserWindowsJavaAndroidiOSSAP

Same as _debug, but prints to the error stream.

Parameters

NameTypeDescription
$messagestringMessage to write to Sahi console error stream

Sahi Pro Classic API _debugToErr

Modes BrowserWindowsJavaAndroidiOSSAP

Prints the message into a file for debugging purposes.

Parameters

NameTypeDescription
$messagestringMessage to write to file
$filePathstringPath to file. Relative path resolves relative to files folder of the current project.

Sahi Pro Classic API _debugToFile

Modes BrowserWindowsJavaAndroidiOSSAP

Runs the script till that point and pauses execution. Acts like a debugger breakpoint. Further playback can be controlled from the Controller Playback tab via Step or Play buttons.

Parameters

NameTypeDescription
None

Sahi Pro Classic API _pause

Modes Browser

Alerts the message on the browser. This allows a very handy, interactive way of debugging scripts.

Parameters

NameTypeDescription
$messagestringMessage to be alerted on browser.
Raw script
//Example:
_alert("Current count is " + $i);

Sahi Pro Classic API _alert

Modes Browser

Brings up a javascript confirm dialog with given message. Use only while debugging.

Parameters

NameTypeDescription
$messagestringMessage to confirm

Sahi Pro Classic API _confirm

Modes Browser

Brings up a javascript prompt with given message. Use only while debugging.

Parameters

NameTypeDescription
$messagestringMessage to prompt

Sahi Pro Classic API _prompt

Modes BrowserWindowsJavaAndroidiOSSAP

Highlights an element with a red border. Used for debugging purposes.

Parameters

NameTypeDescription
$elementHTML DOM elementElement to highlight

Sahi Pro Classic API _highlight