Dropdown options

When I click dropdownlist item , I want to tap options but I couldn’t because of the options didnt have any id or xpath properties. How can I select options (for example third one) under dropdown?

One solution would be to make use of the sendkeys command

M2018 said:

One solution would be to make use of the sendkeys command

How? Can you explain little more clearly?

M2018 said:

One solution would be to make use of the sendkeys command

tutku said:

M2018 said:

One solution would be to make use of the sendkeys command

How? Can you explain little more clearly?

can you explain me too?

Hi Tutku,

I experience this kind of problem but I manage to locate the item.
There’s a way to click the item without id or xpath.

First, you need to find the identity of the dropdown container.
use it as your locator.

Then, use this code:

import org.openqa.selenium.WebElement

//This code will find and collect all the items in the dropdown container.
//but just make sure that the container is already visible before hitting this code.
java.util.List dropDownContents = WebUiCommonHelper.findWebElements(findTestObject(“dropDown_Container”), 30)

//the index represents the item in the dropdown. So, it will click the second item since the items
//are arranged in array.
dropDownContents[1].click()

Hope that helps. . . :slight_smile:

Will it be ok for mobile?
Because i see you are using WebElement, WebUi … etc. in your explenation

Arnel said:

Hi Tutku,

I experience this kind of problem but I manage to locate the item.
There’s a way to click the item without id or xpath.

First, you need to find the identity of the dropdown container.
use it as your locator.

Then, use this code:

import org.openqa.selenium.WebElement

//This code will find and collect all the items in the dropdown container.
//but just make sure that the container is already visible before hitting this code.
java.util.List dropDownContents = WebUiCommonHelper.findWebElements(findTestObject(“dropDown_Container”), 30)

//the index represents the item in the dropdown. So, it will click the second item since the items
//are arranged in array.
dropDownContents[1].click()

Hope that helps. . . :slight_smile:

Hello Arnel, thanks for your comment but as I saw you used in your comment WebUI. But I wonder how to in mobile? Thanks.

Hi

There’s a counterpart of WebUI in katalon which is Mobile. For example;

In WebUI you can do this
WebUI.getText()
WebUI.click()
. . . . . . .and more

In Mobile you can do this
Mobile.getText()
Mobile.click()
. . . . . . .and more

For WebUiCommonHelper the counterpart of it is MobileCommonHelper

It’s worth to try

:slight_smile: