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.
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 | ||
Command | Target | Value |
open | http://only-testing-blog.blogspot.com/2013/11/new-test.html | |
select | css=select | index=2 |
assertNotSelectedIndex | css=select | 1 |
assertNotSelectedIndex | css=select | 2 |
assertNotSelectedIndex | css=select | 3 |
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 | ||
Command | Target | Value |
open | http://only-testing-blog.blogspot.com/2013/11/new-test.html | |
addSelection | css=select[name="FromLB"] | index=2 |
addSelection | css=select[name="FromLB"] | index=3 |
assertNotSelectedIndexes | css=select[name="FromLB"] | 2,4 |
addSelection | css=select[name="FromLB"] | index=2 |
removeSelection | css=select[name="FromLB"] | index=3 |
addSelection | css=select[name="FromLB"] | index=4 |
assertNotSelectedIndexes | css=select[name="FromLB"] | 2,4 |
addSelection | css=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