Error - Unable to detect element in a drop-down list

Hello,

I am trying to select an element from a drop-down list, unfortunately, Katalon shows an error.

Groovy code lines:
def addStatut(param_statut) {
WebUI.click(findTestObject(‘Object Repository/SpyElements/3_KYC/3_SituationProPatrimo/00_Statut/000_button_input’))
WebUI.selectOptionByValue(findTestObject(‘Object Repository/SpyElements/3_KYC/3_SituationProPatrimo/00_Statut/000_input_statut22’), param_statut, false)
Thread.sleep(4000)
}

FYI: param_statut is already defined in the Example table in the feature file.

Is there any needed configuration to manage the drop-down lists?
Could you please help me to work arround this error?

1 Like

You are trying to use, “WebUI.selectOptionByValue”, on an element that is not a select tag. (See part of your error message below.) The “selectOptionByValue”, “selectOptionByLabel” and “selectOptionByIndex” only work on a select tag.

image

It may be that you need to start typing something for the drop-down to expose options, or you may have to review your element’s xpath, but we would need to see the HTML and etc. to assist you further.

Hello,

Thank you for your answer.

Please find below a screenshot of html

The element’s tag is input, so none of the “selectOptionByLabel”, “selectOptionByValue” “selectOptionByIndex” would work. However, if you were manually getting the element to “work”, how would you do that? Would you click on the Statut field? Or something else?

If you have to click on the Statut field to get it to work, then you need to do that same as you do in your method above:

WebUI.click(findTestObject('SpyElements/3_KYC/3_SituationProPatrimo/00_Statut/000_button_input')

However, after clicking on the textbox, now you need to see the HTML of the “table” that appears and make a choice of the listing from that, but likely not by using any of the “selectOptionBy” methods. I think you will have to “move” through the list like a web table and “click” on the appropriate choice.

Hello,

Thank you very much for your answer.
In fact, I worked around the problem by clicking directly on the object (Li_Emplyée) via a WebUI.ClickObject
This wil answer to your question :slight_smile: This is how I do manually