This is a Browser Action API.
A prompt message looks like this: Click for prompt dialog
Javascript calls to prompt(msg) are mocked out by Sahi so that it does not stop the playback.
Sahi by default returns “” if a prompt dialog comes up.
It is possible to make the prompt return the value one wants, by specifying
before the statement which triggers the prompt dialog.
If there was no expectation set, Sahi will return “”.
It is also possible to get the text of the last occurred prompt dialog using
_expectPrompt(label, value)
The parameters are:
<script type="text/javascript">
function showPrompt(){
var t2 = document.f2.t2;
t2.value = prompt("Some prompt?");
}
</script>
<form name="f2">
<input type="button" name="b1" value="Click For Prompt" onclick="showPrompt()">
<input type="text" name="t2">
</form>
_expectPrompt("Some prompt?", "abc")
_click(_button("Click For Prompt"));
_assertNotNull(_textbox("t2"));
_assertEqual("abc", _textbox("t2").value);
_assertEqual(_lastPrompt(), "Some prompt?");