"verifySelectOptions", "verifySelectedLabel" and "verifySelectedIndex" commands works with drop down list box or multi select list box. Let me explain all of three first and then will see them with example.
Selenium IDE "verifySelectOptions" Command
"verifySelectOptions" command used for verification of list box option values. It will show error message if
defined values not available in list box. You can also use it for verification of option values. If not found match then selenium will return error message in log.
Using "verifySelectedLabel" Command in Selenium
As name suggect, "verifySelectedLabel" command will verify the name of selected label. If not found then selenium will return error message in log.
Selenium "verifySelectedIndex" Command
Every label contains index value in drop down and you can verify correct indexed label selection using "verifySelectedIndex" command. Let we see all three commands with example.
New Test | ||
Command | Target | Value |
open | http://only-testing-blog.blogspot.com/2013/09/testing.html | |
verifySelectOptions | name=FromLB | USA,Russia,Japan,Mexico, India,Germany,Italy,Spain, Malaysia,Greece |
verifySelectOptions | name=FromLB | Russia,Japan,Mexico, India,Germany,Italy,Spain |
select | name=FromLB | label=Russia |
verifySelectedLabel | name=FromLB | India |
verifySelectedLabel | name=FromLB | Russia |
verifySelectedIndex | name=FromLB | 1 |
verifySelectedIndex | name=FromLB | 5 |
View More verification command examples.
In above example, all three commands inserted 2 times. one with incorrect value and one with correct value.
- 1st "verifySelectOptions" command will pass because Actual value 'USA,Russia,Japan,Mexico,India,Germany,Italy,Spain,Malaysia,Greece' will match with targeted value 'USA,Russia,Japan,Mexico,India,Germany,Italy,Spain,Malaysia,Greece'.
- 2nd "verifySelectOptions" command will Fail.
- 1st "verifySelectedLabel" will be fail because current selected label 'Russia' will not match with 'India'.
- 2nd "verifySelectedLabel" will be pass.
- 1st "verifySelectedIndex" command will pass
- 2nd "verifySelectedIndex" command will be fail because label 'Russia' has index = 1.
Good Example ..easy to understand for the beginers
ReplyDelete1st "verifySelectOptions" is giving me an error saying did not match with actual value . pls help
ReplyDeleteHello,
ReplyDeleteHow to identify the element "name=FormLB"?
Which tool should be used to identify UI elements?
Please reply ASAP.
Thanks!
You can use firebug and firepath to identify element components
DeleteI have used the same, but in above example getting error @ verifySelectOptions name=FromLB
DeletePlease help.
Also please let me know from where i can get the information like which parameters can be used in different commands.
For ex : In verifySelectOptions command which parameter can be used in target. can we use css, id, xpath etc?
You can use any type of locator(css, id, xpath etc) of element In target column.
DeletePlease fill form given on bellow link. Will try to solve your all doubts on skype.
http://software-testing-tutorials-automation.blogspot.com/p/request-free.html
It has error: [error] Actual value 'USA,Russia,Japan,Mexico,India,Germany,Italy,Spain,Malaysia,Greece' did not match 'USA,Russia,Japan,Mexico, India,Germany,Italy,Spain'.Please help me!
DeleteIt Is Failing because actual values and expected values not matching In 2nd verifySelectOptions. It Is Intensional placed to show you how this command works when values match and not match
DeleteThis comment has been removed by the author.
DeleteIt is very useful
ReplyDeleteIt very useful for beginers
ReplyDeleteThank a lot
ReplyDeleteExcellent blog
ReplyDeleteThanks, Easy for understand
ReplyDelete