Selenium IDE Tutorials - "assertConfirmationNotPresent" and "assertConfirmationPresent" Example

My all tutorials on Selenium IDE are with practical examples and you can view all command examples on Example Page -1 and Example Page -2. Let me describe you 2 more selenium IDE commands which are related to confirmation message. We have already seen how to use
"assertConfirmation" and "verifyConfirmation" commands. "assertConfirmationNotPresent" and "assertConfirmationPresent" are very related to them. Let me first describe them and then provide you one simple example.

"assertConfirmationNotPresent" Command
"assertConfirmationNotPresent" command will pass if there is not any confirmation message present on software web application page when it is executed. Else if there is any confirmation message on page then it will return "[error] true" in log and stop the script execution.

Example 1 :
New Test
CommandTargetValue
openhttp://only-testing-blog.blogspot.com/2013/11/new-test.html
assertConfirmationNotPresent

clickcss=button
assertConfirmationNotPresent
j
clickcss=div > input[type="button"]

In above example, When "assertConfirmationNotPresent" command executed first time, it will pass because there is not any confirmation message. But when 2nd "assertConfirmationNotPresent" command will fail because confirmation message is generated by previous "click" command.

"assertConfirmationPresent" Command
"assertConfirmationPresent" Command works opposite to "assertConfirmationNotPresent" command. It will pass if there is any confirmation message on page. Else it will return "[error] false" in log and stop the execution.

Example 2 :
New Test
CommandTargetValue
openhttp://only-testing-blog.blogspot.com/2013/11/new-test.html
assertConfirmationPresent

clickcss=button
assertConfirmationPresent
j
clickcss=div > input[type="button"]

In this example, 1st "assertConfirmationPresent" command will fail because there is not any confirmation message present on page on that stage

No comments:

Post a Comment