“assertVisible” and “assertNotVisible” Commands Example For Selenium IDE

“assertVisible” and “assertNotVisible” Commands frequently used commands in selenium IDE if you are using selenium IDE for your software web application regression testing. Both “assertVisible” and “assertNotVisible” commands are useful to check element visibility on application software page.You can use

“assertVisible” and “assertNotVisible” commands to stop execution on fail and you can use “verifyVisible” and “verifyNotVisible” commands for further execution on fail. Let me give you simple examples.

“assertNotVisible” Command
“assertNotVisible” command will check element visibility on page and will pass if targeted element is not visible on page. If targed element is present on page then it will return ‘[error] true’ in execution log and selenium will stop execution. Look in to bellow example, “assertNotVisible” will return ‘[error] true’ in execution log because element is already there on page.

New Test
Command Target Value
open http://www.w3schools.com/css/css_display_visibility.asp
assertVisible css=#imgbox2 > input.box
assertNotVisible css=#imgbox2 > input.box

“assertVisible” Command
“assertVisible” command will check visibility of element on page and return ‘[error] false’ if element not visible on page. In bellow example, “assertVisible” will return error because now targeted element is hided from page using previous “click” command.

New Test
Command Target Value
open http://www.w3schools.com/css/css_display_visibility.asp
click css=#imgbox2 > input.box
assertVisible css=#imgbox2 > input.box
assertNotVisible css=#imgbox2 > input.box

Try both commands in your software web application for better excercise.

Leave a Reply

Your email address will not be published. Required fields are marked *