Skip to content

How do I validate if a particular option of the drop-down is NOT selected

This example demonstrates validating if a particular option is NOT selected from the drop-down list.

In the solution shown below, you will validate if the option "Select State" is NOT selected from the "Select State" drop-down in HICC application using the "verifyNotSelectedLabel" command.

Solution:

# Command Target Value
Select the label 'New Jersey' from the drop-down
1 select //select[@id="dpl_state"] label=New Jersey
Validating that the required/some label is selected by checking "Select State" is not selected
2 verifyNotSelectedLabel //select[@id="dpl_state"] Select State

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