APIs used in Debugging Sahi Scripts
abstract
Some APIs are good for debugging Sahi scripts. They are mostly removed once debugging is done.
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
$message | string | Message to write to Sahi console |
Return Value
Modes Supported :
Raw Script
// Example:
_debug("Current count is " + $i);
Sahi Pro Classic API :_debug
Same as _debug, but prints to the error stream.
Parameters
$message | string | Message to write to Sahi console error stream |
Return Value
Modes Supported :
Raw Script
Sahi Pro Classic API :_debugToErr
Prints the message into a file for debugging purposes.
Parameters
$message | string | Message to write to file |
$filePath | string | 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
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
Alerts the message on the browser. This allows a very handy, interactive way of debugging scripts.
Parameters
$message | string | Message to be alerted on browser. |
Return Value
Modes Supported :
Raw Script
//Example:
_alert("Current count is " + $i);
Sahi Pro Classic API :_alert
Brings up a javascript confirm dialog with given message. Use only while debugging.
Parameters
$message | string | Message to confirm |
Return Value
Modes Supported :
Raw Script
Sahi Pro Classic API :_confirm
Brings up a javascript prompt with given message. Use only while debugging.
Parameters
$message | string | Message to prompt |
Return Value
Modes Supported :
Raw Script
Sahi Pro Classic API :_prompt
Highlights an element with a red border. Used for debugging purposes.
Parameters
$element | HTML DOM element | Element to highlight |
Return Value
Modes Supported :
Raw Script
Sahi Pro Classic API :_highlight