"verifyNotAlert" and "assertNotAlert" are assertion commands of selenium IDE. Both are works opposite to "verifyAlert" and "assertAlert" commands. First of all you look at example of "verifyAlert" and "assertAlert" Commands and then execute bellow given example to understand actual function of
"verifyNotAlert" and "assertNotAlert" commands. All these commands are works with only alert box. Let me describe both of them first so you can understand how to use them.
"verifyNotAlert" Command
"verifyNotAlert" command will verify the alert message text generated during previous action and will fail if targeted text will match with actual alert text. It will be pass if both texts will not match.
"assertNotAlert" Command
"assertNotAlert" command will works same as "verifyNotAlert" command. Only difference is - if "assertNotAlert" command will fail then selenium IDE will stop execution and if "verifyNotAlert" Command will fail then selenium IDE will continue its execution.
Run bellow given example in your selenium IDE and look at pass and failure status of both the commands.
New Test | ||
Command | Target | Value |
open | http://only-testing-blog.blogspot.com/2013/10/table.html | |
click | css=div > input[type="button"] | |
verifyNotAlert | XYZ | |
click | css=div > input[type="button"] | |
verifyNotAlert | Hi.. This is alert message! | |
click | css=div > input[type="button"] | |
assertNotAlert | XYZ | |
click | css=div > input[type="button"] | |
assertNotAlert | Hi.. This is alert message! | |
click | css=div > input[type="button"] | |
assertNotAlert | XYZ |
When you run above example in your selenium IDE window, 1st "verifyNotAlert" and "assertNotAlert" commands will be pass because targeted text 'XYZ' will not match with actual alert text 'Hi.. This is alert message!' but 2nd "verifyNotAlert" and "assertNotAlert" commands will be fail because targeted text 'Hi.. This is alert message!' will match with actual alert text 'Hi.. This is alert message!'. So last 2 commands will be not executed due to the failure of previous "assertNotAlert" command.
Try both the commands in your own software web application. You can view list of all selenium IDE commands with examples to implement in your test cases.
No comments:
Post a Comment