Use of "assertSelectOptions" and "assertNotSelectOptions" Commands in Selenium IDE

As you know, there are many assertions commands available in selenium IDE. You can view list of assertion commands with example tutorial if you wish."assertSelectOptions" and "assertNotSelectOptions" commands are part of selenium IDE assertions and you can use them with drop down or list box of your software application page to assert the values inside it. I posted examples of 2 related
("verifySelectOptions" and "storeSelectOptions") command's post in past. Let we take simple practical example of list box and try to apply both these commands on it.

"assertSelectOptions" Command
You can use "assertSelectOptions" command when you want to verify values in list box and if expected values are not there in list box then not want to execute remaining script. "assertSelectOptions" command will check for expected values in targeted element. If match then will be pass successfully else it will return '[error] Actual value 'something something..' did not match 'something something1..'' and stop execution.

"assertNotSelectOptions"  Command
"assertNotSelectOptions" command will works opposite to "assertSelectOptions" command. If expected text match with targeted text then it will return '[error] Actual value 'something something..' did match 'something something..''. Else it will be pass.


New Test
CommandTargetValue
openhttp://only-testing-blog.
blogspot.com/ 2013/09/testing.html

assertSelectOptionsname=FromLBUSA,Russia,Japan,Mexico,
India,Germany,Italy,Spain,
Malaysia,Greece
assertNotSelectOptionsname=FromLBUSA,Russia,Japan,Mexico,
India,Germany,Italy,Spain,
Malaysia,Greece

New Test
CommandTargetValue
openhttp://only-testing-blog.blogspot.com/ 2013/09/testing.html
assertNotSelectOptionsname=FromLBFrance,Germany,Thailand,
Japan,Singapore
assertSelectOptionsname=FromLBFrance,Germany,Thailand,
Japan,Singapore

When you use above examples, remove in between space from labels displayed in Value column. 

  • In 1st example, "assertSelectOptions" command will pass because Actual value and expected values will match perfectly but 2nd command "assertNotSelectOptions" will fail because it will pass only if actual and expected values will match.
  • Opposite to 1st example - In 2nd example, "assertNotSelectOptions" command will pass but "assertSelectOptions" command will fail.

No comments:

Post a Comment