Selenium IDE Example Tutorial On "assertNotSelectedIndexes" and "assertNotSelectedIndex"

In Selenium IDE, "assertNotSelectedIndexes" and "assertNotSelectedIndex" commands are nearest same. Both are working with drop down or list box of software web application page. If you knows how to use "assertNotSelectedLabel" and "assertNotSelectedLabels" commands then it will be very easy for you
to understand these 2 commands. "assertNotSelectedIndex" command works with single selected label and "assertNotSelectedIndexes" command is useful with multiple selected labels.

"assertNotSelectedIndex" Command
This command is useful to verify the index of current selected label from drop down or list box. If index of current selected label will match with expected then it will fail and return error in log.

Example 1
New Test
CommandTargetValue
openhttp://only-testing-blog.blogspot.com/2013/11/new-test.html
selectcss=selectindex=2
assertNotSelectedIndexcss=select1
assertNotSelectedIndexcss=select2
assertNotSelectedIndexcss=select3

In above example, 1st "assertNotSelectedIndex" command will pass because current selected label has index = 2. But 2nd "assertNotSelectedIndex" command will fail and return error "[error] Actual value '2' did match '2'".

"assertNotSelectedIndexes" Command
"assertNotSelectedIndexes" command will work same as "assertNotSelectedIndex" command but for multiple selected labels. If expected and actual will match then script will fail and return error in log. Run bellow given example.

Example 2
New Test
CommandTargetValue
openhttp://only-testing-blog.blogspot.com/2013/11/new-test.html
addSelectioncss=select[name="FromLB"]index=2
addSelectioncss=select[name="FromLB"]index=3
assertNotSelectedIndexescss=select[name="FromLB"]2,4
addSelectioncss=select[name="FromLB"]index=2
removeSelectioncss=select[name="FromLB"]index=3
addSelectioncss=select[name="FromLB"]index=4
assertNotSelectedIndexescss=select[name="FromLB"]2,4
addSelectioncss=select[name="FromLB"]index=5

In this example, 1st "assertNotSelectedIndexes" command will pass because current selected indexes are 2 and 3. But 2nd "assertNotSelectedIndexes" command will fail because now expected selected indexes 2,4 will match with actual selected indexes 2,4 and return error "[error] Actual value '2,4' did match '2,4'".

No comments:

Post a Comment