SUBSCRIBE HERE TO GET POST UPDATES VIA EMAIL :

Delivered by FeedBurner

"verifyNotAlert" and "assertNotAlert" Commands With Examples In Selenium IDE

"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
CommandTargetValue
openhttp://only-testing-blog.blogspot.in/2013/10/table.html
clickcss=div > input[type="button"]
verifyNotAlertXYZ
clickcss=div > input[type="button"]
verifyNotAlertHi.. This is alert message!
clickcss=div > input[type="button"]
assertNotAlertXYZ
clickcss=div > input[type="button"]
assertNotAlertHi.. This is alert message!
clickcss=div > input[type="button"]
assertNotAlertXYZ

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