| || |
Selenium IDE - assertElementNotPresent true even though element not displayed
I'm using Selenium IDE to capture some tests against a webform. The webform has a number of fields, several of which are only displayed when a particular option is chosen in other fields e.g.
Field 'C' is only displayed when Field 'A' = option 2.
Following on from the above example, I'm trying to use the Selenese command 'assertElementNotPresent' to show that when Field 'A' = 1, then Field 'C' is NOT displayed.
I'm having a problem in that my test is failing at the 'assertElementNotPresent' Selenese command because the returned value is 'true' e.g. Selenium thinks that Field 'C' is present even though 'Field 'C' is NOT displayed on the webform because Field 'A' does NOT = 2.
I have tried reversing the command using 'assertElementPresent' and the test incorrectly passes.
My goal is to set Field 'A' = 1, which should result in Field 'C' not being displayed. This in turn should then result in the 'assertElementNotPresent' Selenese command = false and my test case passing.
Any help here would be gratefully appreciated.
Please bear in mind that I am very much a beginner as far as automation (Selenium) is concerned and I am not a developer.
Assert element not present, means it should be true if it is not present. Sounds like it's working as expected.
'assertElementNotPresent' Selenese command because the returned value is 'true' e.g. Selenium thinks that Field 'C' is present even though 'Field 'C' is NOT displayed
Checks if the element with the specified target does not exists somewhere on the page. The test will fail if the element exist.
assertElementPresent may rescue you.