I have the following form and script in a test page:
<form>
<button id="doublealert1" onclick="alert('First Alert'); alert('Second Alert'); return false;">Double alert button</button>
<input type="button" id="doublealert2" onclick="alert('First Alert'); alert('Second Alert'); " value="Double alert input" />
<input type="button" id="singlealert1" onclick='alert("Single Alert");' value="Single alert input" />
<input type="button" id="functionalert" onclick="myFunction();" value="Function alert input" />
</form>
<script>
function myFunction() {
alert("Function alert");
}
</script>
When I run the following test case, it fails at the verifyAlert
command
open | http://localhost/TestPage.htm | |
chooseOkOnNextConfirmation | | |
click | id=singlealert1 | |
assertAlert | Single Alert | |
chooseOkOnNextConfirmation | | |
click | id=singlealert1 | |
verifyAlert | Single Alert | |
And here is the Log
[info] Playing test case Test Test Suite / Alert Tests
[info] Time: Thu Feb 07 2019 12:30:54 GMT+0000 (Greenwich Mean Time) Timestamp: 1549542654697
[info] OS: Windows Version: 10
[info] Browser: Chrome Version: 71.0
[info] If the test cannot start, please refresh the active browser tab
[info] Executing: | open | http://localhost/TestPage.htm | |
[info] Executing: | chooseOkOnNextConfirmation | | |
[info] Executing: | click | id=singlealert1 | |
[info] Executing: | assertAlert | Single Alert | |
[info] Executing: | chooseOkOnNextConfirmation | | |
[info] Executing: | click | id=singlealert1 | |
[info] Executing: | verifyAlert | Single Alert | |
[error] did not match
I expected it to work the same as assertAlert
, which, as you can see, passed.