How to select value from dropdown using the name of the avaible options?

Hello,
I’m trying to select the value from the dropdown by using the name.
However, I keep getting ‘No options match’.

Here I have a few options in the dropdown, I want to select the option with the name ’ ABX ’

image

My code:

WebUI.selectOptionByLabel(findTestObject('myObject'), 
    ' ABX ', true)

The object is located correctly cause when I do:

WebUI.selectOptionByIndex(findTestObject('myObject'), 
    '1', FailureHandling.STOP_ON_FAILURE)

It selects the correct option.
So I’m guessing something is off with my syntax, there are white spaces at the beginning and at the end of the options as well.

Tried this as well but with the same result:

WebUI.selectOptionByValue(findTestObject('myObject'), 
    ' ABX ', false)

Hi @wolczoskar

Try WebUI.selectOptionByValue(findTestObject('myObject'),  '9 ', false)
or WebUI.selectOptionByIndex(findTestObject('myObject'), 1)
or WebUI.selectOptionByLabel(findTestObject('myObject'), 'ABX', false)
1 Like
WebUI.selectOptionByLabel(findTestObject(‘myObject’), ‘ABX’, false)

This one works, thanks, why bool needs to be set to false?

Hi @wolczoskar,
See this link: [WebUI] Select Option By Label | Katalon Docs or [WebUI] Select Option By Value | Katalon Docs

1 Like