Skip to content

How do I validate the selected options of a multi-select drop-down

This example demonstrates selecting multiple options from a multi-select drop-down and validating the selected options.

In the solution shown below, you will validate all the options selected from the "Select State" drop-down in HICC application using the "assertSelectedLabels" command.

Solution:

# Command Target Value
Selecting first option
1 select //select[@id="dpl_state"]        label=New Jersey
Selecting second option
2 select //select[@id="dpl_state"] label=California
Selecting third option
3 select //select[@id="dpl_state"] label=New York
Validate all the selected options
4 assertSelectedLabels //select[@id="dpl_state"] New Jersey,California,New York

Note: The multi-select drop-down is currently not available in HICC, hence if you execute the above solution, it will not work.  

Tips, Tricks, Gotchas & Best Practices:  

  • To understand how to select an option, click here.
  • As an alternative to validating the selected option, you are encouraged to use either of the commands as given below for each option locator:

Feedback and Knowledge Base