Selenium IDE Tutorial : "verifySelectedId" and "verifyNotSelectedId" commands with example

Earlier we had seen how to verify selected value of drop down or list box using LABEL, VALUE and INDEX. In selenium IDE, there is one more command is "verifySelectedId" to verify id of selected value in drop down or list box. If your drop down value contains id attribute then you can use it to select it. Let me
explain you two related commands with example.

"verifySelectedId" Command
"verifySelectedId" command will check the id attribute of current selected value and compare it with expected id. If both match then it will pass else it will fail and return error like "[error] Actual value 'car1' did not match 'car2'" in log. 

"verifyNotSelectedId" Command
"verifyNotSelectedId" command will retrieve and compare id attribute of selected value. If expected and actual match then it will fail else it will pass. Both these commands works only if drop down values contain id attribute.

New Test
CommandTargetValue
openhttp://only-testing-blog.blogspot.com/2014/01/textbox.html
verifySelectedId//select[@id='Carlist']car1
verifySelectedId//select[@id='Carlist']car2
verifyNotSelectedId//select[@id='Carlist']car1
verifyNotSelectedId//select[@id='Carlist']car2

Run above example and verify result. For both commands, one will pass and one will fail. Prepare same test case of your software web application's regression test scenario and verify result.

1 comment: