Selenium IDE "verifyElementNotPresent" and "waitForElementNotPresent" Commands With Examples

In any software application regression test case, you need to verify and wait for different conditions as per test scenario requirement. Selenium IDE has many different buit in VERIFICATION and WAITFOR commands to handle that particular situation. Today we will look at "verifyElementNotPresent" and
"waitForElementNotPresent" commands with examples. First of all let me describe you both of them and then will look at practical example.

"verifyElementNotPresent" Command
"verifyElementNotPresent" command will verify that targeted element is present on page or not. It will pass if targeted element is not present on page else it will return [error] true in execution log. You can view example of "verifyElementPresent" command which works opposite to "verifyElementNotPresent" command.

VIEW WEBDRIVER EXAMPLE OF "verifyElementNotPresent"

"waitForElementNotPresent" Command
Selenium IDE will wait till targeted element of "waitForElementNotPresent" command disappears from the page. Once targeted element disappears from the page, selenium IDE will execute next command. Maximum wait time will be default timeout time of selenium IDE.

Example of "verifyElementNotPresent" and "waitForElementNotPresent" Commands

New Test
CommandTargetValue
openhttp://only-testing-blog.blogspot.com/2014/01/textbox.html
verifyElementNotPresent//input[@id='text3']
waitForElementNotPresent//input[@id='text4']
verifyElementNotPresent//input[@id='text3']

In above example, 1st "verifyElementNotPresent" command will pass because on that stage, targeted element //input[@id='text3'] is not present on page. 2nd "waitForElementNotPresent" command will wait for targeted element to appear on page. last "verifyElementNotPresent" command will return error because on that stage targeted element is available on page.

1 comment:

  1. Hi! All Your lessons are very cool.
    But can You explain me one thing:
    when I use "openWindow" for "open" while executing example I got results different from ones got with "open". In fact, all commands shown passed and test case doesn't wait "text4" to disappear (!!!).

    Thanks for help!!!

    ReplyDelete