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


#1

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.
WebUI.click(findTestObject('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:

Reason:
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.run(Potato Export:94)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:328)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:319)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:298)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:290)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:224)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:106)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:97)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1550520644444.run(TempTestCase1550520644444.groovy:22)

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!


#2

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.


#4

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

All elements in the drop down menu can be selected.