This is a Browser Action API.
A confirm message looks like this: Click for confirm dialog
Javascript calls to confirm(msg) are mocked out by Sahi so that it does not stop playback.
Sahi by default acts as if “OK” was clicked when a confirm dialog comes up.
It is possible to make the confirm return as if it was cancelled by setting
before the statement which triggers the confirm dialog.
If there was no expectation set, Sahi will return true.
It is also possible to get the text of the last occurred confirm dialog using
_expectConfirm(label, value)
The parameters are:
<script type="text/javascript">
function showConfirm() {
var t1 = document.f1.t1;
if (confirm("Some question?")) {
t1.value = "oked";
} else {
t1.value = "canceled";
}
}
</script>
<form name="f1">
<input type="button" name="b1" value="Click For Confirm" onclick="showConfirm()">
<input type="text" name="t1">
</form>
_click(_button("Click For Confirm"));
_assertNotNull(_textbox("t1"));
_assertEqual("oked", _textbox("t1").value);
_assertEqual(_lastConfirm(), "Some question?");
_expectConfirm("Some question?", false);
_click(_button("Click For Confirm"));
_assertNotNull(_textbox("t1"));
_assertEqual("canceled", _textbox("t1").value);
_assertEqual(_lastConfirm(), "Some question?"); //Kind of redundant here.