In this article, we’ll quickly cover those core Selenium commands and then show how Katalon Studio streamlines the same process - letting you capture a dropdown with Spy Web and select options using built-in keywords like selectOptionByValue or selectOptionByIndex, so you can automate dropdown interactions without writing boilerplate code, but first...
What is dropdown in Selenium?
In web application, a dropdown menu (also called a dropdown list) is a graphical control element that lets users pick one option from a list. When inactive, it shows a single selected value. When clicked, it expands to display all available options. A dropdown is presented as follows in HTML:
What is Select class in Selenium?
The Select class provides convenient methods to interact with <select> HTML elements. You must first locate the dropdown element, then use Select to select or deselect items.
Common <select> class methods
1. selectByIndex()
Select the option at the given index. the Index starts from `0`.
Example Java code:
What it does: This code selects the option at index 2, which corresponds to the third option in the list.
2. selectByVisibleText()
Select all options that display text matching the argument.
Example Java code:
What it does: The code finds the dropdown by its ID, wraps it with the `Select` class, and selects the option with displayed text matching "Audi".
3. selectByValue()
Select all options that have a value matching the argument.
Example Java code:
What it does: The code selects the option with value attribute as "saab".
4. deselectAll()
Clear all selected items. Note that this method only works if the dropdown allows a multi-select dropdown.
Example Java code:
Handle dropdown with Katalon Studio
Katalon Studio provides built-in keywords for the Select class that simplify dropdown handling and automate your testing workflow.
Let’s give it a try! First we’ll need to capture some objects that we can use in the test case.
📄 Learn more in our documentation: How to handle dropdown menu in Katalon Studio
Capture objects with Spy Web
Step 1. In your test project, open the Spy Web tool.

Step 2. Provide a link in the URL field. Here we’re using the https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_select site that contains a drop-down list.
Step 3. Click Start to launch your session. Navigate your cursor to the dropdown and right-click > Capture Object.

The object we captured is a <select> HTML element, and its XPath attributes are displayed in the Object Spy dialog.

Click Save > OK in the Add Element to Object Repository dialog..png?width=1190&height=1192&name=Screenshot%202025-05-19%20at%2013.45.05%20(1).png)
Use Katalon built-in keywords
With the objects you have captured, you can start creating test steps with Katalon Studio built-in keywords.
Open your test case in the Manual view, create a test case using the WebUI.selectOptionByValue keyword that finds the value="saab”

You can test it out with this script:
If you want to use another keyword, for example WebUI.selectOptionByIndex, try:
Conclusion
Handling dropdowns is straightforward with Selenium’s Select class - just locate the <select> element and call methods like selectByIndex, selectByVisibleText, or selectByValue - but maintaining those scripts can become tedious over time. Katalon Studio streamlines the same workflow by letting you capture the dropdown with Spy Web and then call keywords like selectOptionByValue or selectOptionByIndex without writing extra boilerplate. Whether you prefer full control through Selenium code or a faster, low-code approach in Katalon, both paths ensure your dropdown interactions stay reliable and easy to maintain.
