Skip to content

How do I read the option(s) selected in the drop-down

This example demonstrates reading and storing the selected option of the drop-down from the UI.

In the solution shown below, you will read the option(s) selected from the "Select State" drop-down in HICC application using the "storeSomethingSelected" command.

Note: You are reading the value of an element from the UI and initializing to a variable <Variable Name>. The notation to reuse the value of the variable in Worksoft SaaS is ${<Variable Name>}.

Solution:

# Command Target Value
Read and store the selected option of the drop-down
1 storeSomethingSelected //select[@id="dpl_employerInsuranceDropdown"] SelectedOption
Print the option that is selected
2 echo ${SelectedOption}  

Tips, Tricks, Gotchas & Best Practices:  

  • As an alternative to read the selected option(s), you are encouraged to use either of the commands as given below for each option locator:

Feedback and Knowledge Base