SUBSCRIBE HERE TO GET POST UPDATES VIA EMAIL :

Delivered by FeedBurner

Selenium "verifySelectOptions", "verifySelectedLabel" and "verifySelectedIndex" Example


"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
CommandTargetValue
openhttp://only-testing-blog.blogspot.in/2013/09/testing.html
verifySelectOptionsname=FromLBUSA,Russia,Japan,Mexico,
India,Germany,Italy,Spain,
Malaysia,Greece
verifySelectOptionsname=FromLBRussia,Japan,Mexico,
India,Germany,Italy,Spain
selectname=FromLBlabel=Russia
verifySelectedLabelname=FromLBIndia
verifySelectedLabelname=FromLBRussia
verifySelectedIndexname=FromLB1
verifySelectedIndexname=FromLB5

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.

14 comments:

  1. Good Example ..easy to understand for the beginers

    ReplyDelete
  2. 1st "verifySelectOptions" is giving me an error saying did not match with actual value . pls help

    ReplyDelete
  3. Hello,

    How to identify the element "name=FormLB"?
    Which tool should be used to identify UI elements?

    Please reply ASAP.

    Thanks!

    ReplyDelete
    Replies
    1. You can use firebug and firepath to identify element components

      Delete
    2. I have used the same, but in above example getting error @ verifySelectOptions name=FromLB

      Please 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?

      Delete
    3. You can use any type of locator(css, id, xpath etc) of element In target column.
      Please 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

      Delete
    4. 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!

      Delete
    5. It 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

      Delete
    6. This comment has been removed by the author.

      Delete
  4. Thanks, Easy for understand

    ReplyDelete