Sahi Pro - APIs used in Debugging Sahi Scripts
abstract
Some APIs are good for debugging Sahi scripts. They are mostly removed once debugging is done.
_debug
Since Sahi Pro: 3.5Since Sahi OS: 2
_debug($message)
Arguments
$message | string | Message to write to Sahi console |
Details
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.
Example:
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.
Example:
_debug("Current count is " + $i);
_debugToErr
Since Sahi Pro: 3.5Since Sahi OS: 2
_debugToErr($message)
Arguments
$message | string | Message to write to Sahi console error stream |
Details
Same as _debug, but prints to the error stream.
Same as _debug, but prints to the error stream.
_debugToFile
Since Sahi Pro: 3.5Since Sahi OS: 2
_debugToFile($message, $filePath)
Arguments
$message | string | Message to write to file |
$filePath | string | Path to file. Relative path resolves relative to where Sahi's process is started from. |
Details
Prints the message into a file for debugging purposes.
Prints the message into a file for debugging purposes.
_pause
Since Sahi Pro: 5.1.0Since Sahi OS: NA
_pause()
Arguments
None |
Details
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.
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
_alert
Since Sahi Pro: 3.5Since Sahi OS: 2
_alert($message)
Arguments
$message | string | Message to be alerted on browser. |
Details
Alerts the message on the browser. This allows a very handy, interactive way of debugging scripts.
Example:
Alerts the message on the browser. This allows a very handy, interactive way of debugging scripts.
Example:
_alert("Current count is " + $i);
warningDO NOT leave this in a production script, since it needs user input to proceed and will halt execution
_confirm
Since Sahi Pro: 3.5Since Sahi OS: 3.5
_confirm($message)
Arguments
$message | string | Message to confirm |
Details
Brings up a javascript confirm dialog with given message. Use only while debugging.
Brings up a javascript confirm dialog with given message. Use only while debugging.
_prompt
Since Sahi Pro: 3.5Since Sahi OS: 2
_prompt($message)
Arguments
$message | string | Message to prompt |
Details
Brings up a javascript prompt with given message. Use only while debugging.
Brings up a javascript prompt with given message. Use only while debugging.
_highlight
Since Sahi Pro: 3.5Since Sahi OS: 2
_highlight($element)
Arguments
$element | HTML DOM element | Element to highlight |
Details
Highlights an element with a red border. Used for debugging purposes.
Highlights an element with a red border. Used for debugging purposes.