Cannot choose option from drop down menu generated by Oracle Policy Automation (OPA)

Hello everyone,

I’m still fairly new to Katalon Studio and have been trying to automate a test case. Now, i have encountered a problem and been stuck for a while.

I have a drop down menu that is generated by OPA where when I try to run the test, it cannot find the element from within the drop down menu. Meaning that it can find the box that will show the options within the drop down, but it cannot identify them. Now, i’ve used the WebUI method selectOptionByIndex and selectOptionByValue to select which option, but it does not work. I’ve read that you should use those method when options are dynamic?

Here’s the code that interacts with the page, all TestObjects are captured using the Recorder and SpyWeb. Here is what was originally captured by the Recorder:

WebUI.selectOptionByValue(findTestObject('Object Repository/LDT Potato Export/select_Select Business LineAni'), "cba71f66-2ba1-e611-80f5-005056010040|Food|Aliments", true)

It did not work and i changed it into the following:

//Finds the drop down menu and clicks on it.'Object Repository/LDT Potato Export/select_Select Business LineAni'))

//Finds the drop down menu and select the option 2, which in this case is “Food” (See the screenshot below)
WebUI.selectOptionByIndex(findTestObject('Object Repository/LDT Potato Export/select_Select Business LineAni'), 2, true)

I have the following error from what i tried:

groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.selectOptionByIndex() is applicable for argument types: (com.kms.katalon.core.testobject.TestObject, java.lang.Integer, java.lang.Boolean) values: [TestObject - ‘Object Repository/LDT Potato Export/select_Select Business LineAni’, …]
Possible solutions: selectOptionByIndex(com.kms.katalon.core.testobject.TestObject, java.lang.Object), selectOptionByIndex(com.kms.katalon.core.testobject.TestObject, java.lang.Object, com.kms.katalon.core.model.FailureHandling), deselectOptionByIndex(com.kms.katalon.core.testobject.TestObject, java.lang.Object), deselectOptionByIndex(com.kms.katalon.core.testobject.TestObject, java.lang.Object, com.kms.katalon.core.model.FailureHandling), selectOptionByLabel(com.kms.katalon.core.testobject.TestObject, java.lang.String, boolean)
at Potato Export:94)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(
at com.kms.katalon.core.main.TestCaseExecutor.runScript(
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(
at com.kms.katalon.core.main.TestCaseExecutor.execute(
at com.kms.katalon.core.main.TestCaseMain.runTestCase(
at com.kms.katalon.core.main.TestCaseMain.runTestCase(
at com.kms.katalon.core.main.TestCaseMain$runTestCase$ Source)

The HTML Code for the drop down menu:

select class=“form-control col-md-4 valid” id=“ddlBusinessLine” name=“global_global_a_Commodity_level1_guid” required=“required” aria-required=“true” aria-invalid=“false”>Select Business Line
option value=“baac8d7b-2ba1-e611-80f5-005056010040|Animal|Animaux”>Animal
option value=“cba71f66-2ba1-e611-80f5-005056010040|Food|Aliments” selected=“selected”>Food
option value=“7cd8aa6d-2ba1-e611-80f5-005056010040|Plant|Végétaux”>Plant

Any help would be appreciated!

Firstly, for future reference, read this:

The complaint from Katalon is that the arguments you’ve supplied to selectOptionByIndex are the wrong types. Post your actual code so we can help you better.

Also, be aware, the element MUST be a SELECT element for selectOptionByIndex to work.

Thanks for the Tips, I’ve updated my opening post.

All elements in the drop down menu can be selected.