APIs used in Debugging Sahi Scripts

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

Debug

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
$messagestring Message to write to Sahi console
Return Value

Modes Supported :
Raw Script
// Example:

_debug("Current count is " + $i);

Sahi Pro Classic API :_debug


Debug To Err

Same as _debug, but prints to the error stream.

Parameters
$messagestring Message to write to Sahi console error stream
Return Value

Modes Supported :
Raw Script

Sahi Pro Classic API :_debugToErr


Debug To File

Prints the message into a file for debugging purposes.

Parameters
$messagestring Message to write to file
$filePathstring
Path to file. Relative path resolves relative to where Sahi's process is started from.
Path to file. Relative path resolves relative to files folder of the current project.
Return Value

Modes Supported :
Raw Script

Sahi Pro Classic API :_debugToFile


Pause

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.
warningDO NOT leave this in a production script, since it needs user input to proceed and will halt execution

Parameters
None
Return Value

Modes Supported :
Raw Script

Sahi Pro Classic API :_pause


Alert

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

Parameters
$messagestring Message to be alerted on browser.
Return Value

Modes Supported :
Raw Script
//Example:
_alert("Current count is " + $i);

Sahi Pro Classic API :_alert


Confirm

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

Parameters
$messagestring Message to confirm
Return Value

Modes Supported :
Raw Script

Sahi Pro Classic API :_confirm


Prompt

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

Parameters
$messagestring Message to prompt
Return Value

Modes Supported :
Raw Script

Sahi Pro Classic API :_prompt


Highlight

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

Parameters
$elementHTML DOM element Element to highlight
Return Value

Modes Supported :
Raw Script

Sahi Pro Classic API :_highlight