How do I select multiple options from a drop down
This example demonstrates selecting multiple options from a drop down.
In the solution shown below, you will see multiple options are selected from the "Select State" drop-down in HICC application by pressing Ctrl key using "controlKeyDown" command, clicking on the options that are to be selected using "click" command, and releasing the Ctrl key using "controlKeyUp" command.
Solution:
# | Command | Target | Value |
---|---|---|---|
Pressing the "Ctrl" key | |||
1 | controlKeyDown | ||
Clicking on the option "California" | |||
2 | click | xpath=(//select/option[@label="California"])[1] | |
Clicking on the Option "New Jersey" | |||
3 | click | xpath=(//select/option[@label="New Jersey"])[1] | |
Releasing the "Ctrl" key | |||
4 | controlKeyUp |
Note: The multi-select drop-down is currently not available in HICC, hence if you execute the above solution, it will not work. Use this as an example for valid use case wherever applicable.
Tips, Tricks, Gotchas & Best Practices:
- As an alternative to the above solution, you can use the select command for each option and select multiple options from a drop down.