SelectOptionByValue not working


#1

Hi,
I am not sure why, when I use the proper syntax and variables for selectOptionByValue, it is not working. Due to this, I am using the selectOptionByIndex for time being.

Can you please suggest to proceed further ? OR Is there any other way to use this ?

Syntax:
WebUI.selectOptionByValue(findTestObject(‘Object Repository/ORTC04/Page_Govt Inquiry/select_All Contracts’), bllmodass, false, FailureHandling.STOP_ON_FAILURE)


#2

Hi,
If bllmodass is your value, you miss the quote


#3

It is not exact value and it is variable. Due to that I have not given the quote.


#4

That’s why there is an “if” :wink:
Have you error message ?


#5

It is not clear. what is “if” ?
Do you want error message ?


#6

Yes


#7

Hi Helene,
Here is the error log for reference. Please suggest to proceed further.

2019-07-17 18:18:04.300 ERROR c.k.k.c.c.keyword.CucumberReporter - :x: user select the assigned to name “Veerareddy Venkat” FAILED.
Reason:
groovy.lang.MissingMethodException: No signature of method: CreateSaveReport002.findTestObject() is applicable for argument types: (java.lang.String, java.lang.String, com.kms.katalon.core.model.FailureHandling) values: [Object Repository/ORTC02/Page_New Report/select_AssignToList, …]
at CreateSaveReport002.user_select_assigned_name(CreateSaveReport002.groovy:203)
at ✽.user select the assigned to name “Veerareddy Venkat”(C:/Users/vxxxxxx/Katalon Studio/Govt Inquiry/Include/features/002-Create Save Report.feature:28)


#8

Share your test case code too


#9

I believe the issue is how you are handling that variable. From your snippet, everything matches. Assuming that the variable you have is set as type ‘String’ then you should be good.

.findTestObject() is applicable for argument types: (java.lang.String, java.lang.String, com.kms.katalon.core.model.FailureHandling)

This is telling you how it should look and from what you added, the only thing that really could that this off is the variable.


#10

the error message is self explanatory.
the exception it is not raised in the code snipet posted, but in a different method.
so, without the full code, we can do blind guesses for a century, without a solution

No signature of method: CreateSaveReport002.``

#12

Hi… please find the below code… Please suggest to proceed further.

@And("user select the assigned to name (.*)")
def user_select_assigned_name(String assignedto) {
	if(runIndicator2!='N') {
		println " assignedto " + assignedto
		WebUI.selectOptionByValue(findTestObject('Object Repository/ORTC02/Page_New Report/select_AssignToList'), assignedto, false, FailureHandling.STOP_ON_FAILURE)
		WebUI.delay(5)
	}
}

#13

This part of your error seems to be referencing something other than the method you shared above. It looks like you have an error in your script at line 203 where you have something like this:

findTestObject(‘Object Repository/ORTC02/Page_New Report/select_AssignToList’, someString, FailureHandling.OPTIONAL)


#14

Can you post a screenshot of how you have ‘assignedto’ variable setup in Katalon?


#15

Thanks for all your inputs.
Below is the Groovy code and attached the cucumber feature file line highlighted in red.

Code in Groovy:
@And(“user select the assigned to name (.*)”)
def user_select_assigned_name(String assignedto) {
if(runIndicator2!=‘N’) {
println " assignedto " + assignedto
WebUI.selectOptionByValue(findTestObject(‘Object Repository/ORTC02/Page_New Report/select_AssignToList’), assignedto, false, FailureHandling.STOP_ON_FAILURE)
WebUI.delay(5)
}
}