Test Object is not recognize when accessing via DDT

Hi

I have a script that accessing several objects on the webpage and works fine.
Example:

WebUI.waitForElementPresent(findTestObject(‘Page_Inbox/span_CPE410486’), 10)

WebUI.click(findTestObject(‘Page_Inbox/span_CPE410486’))

WebUI.delay(3)

Well - i have decided to access the same objects via DDT.

Example:

CSVData data = findTestData(“DDT1”)

for (def index : (0…data.getRowNumbers() - 1)) {

WebUI.delay(5)

emailClick = (‘Page_Inbox/span_’ + data.internallyGetValue(“OfferType”, index) + data.internallyGetValue(“CID”, index))

println(emailClick)

WebUI.click(emailClick)

Now it is being printed in console precisely as if it is in the 1st example:
WebUI.click(findTestObject(‘Page_Inbox/span_CPE410486’))

However it errors with this error:
Test Cases/Inbox-Tasks FAILED because (of) groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click() is applicable for argument types: (java.lang.String) values: [Page_Inbox/span_CPE410486]

Please let me know if you aware of any workaround or what is incorrect in the above case.

Thank you!!!
Andrew

Hi Andrew,

WebUI.click() expects TestObject as a parameter. You put String there (variable emailClick), so you get error. I assume that this variable is a path to your TestObject in ObjectRepository. So you should use findTestObject(String path) method, which returns TestObject type.

WebUI.click(findTestObject(emailClick))

It is actually the same way as you used in first example :slight_smile:

WebUI.click(findTestObject(‘Page_Inbox/span_CPE410486’))

Marek Melocik said:

Hi Andrew,

WebUI.click() expects TestObject as a parameter. You put String there (variable emailClick), so you get error. I assume that this variable is a path to your TestObject in ObjectRepository. So you should use findTestObject(String path) method, which returns TestObject type.

WebUI.click(findTestObject(emailClick))

It is actually the same way as you used in first example :slight_smile:

WebUI.click(findTestObject(‘Page_Inbox/span_CPE410486’))

Hi Marek

I have tried with your suggestion, and it worked. :slight_smile:

However only if i DO NOT use one of these:

WebUI.waitForElementPresent(findTestObject(emailClick, 10))

OR
WebUI.waitForElementVisible(findTestObject(emailClick, 10))

If i use the above - i will get this error:

Test Cases/Inbox-Tasks FAILED because (of) groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.testobject.ObjectRepository.findTestObject() is applicable for argument types: (java.lang.String, java.lang.Integer) values: [Page_Inbox/span_CPE410486, 10]

Possible solutions: findTestObject(java.lang.String), findTestObject(java.lang.String, java.util.Map)

Do you know what causing this?

Thank you!
Andrew

Andrew

Take more care with your method calls and their arguments. Your error is telling you what is wrong – it’s saying there is no existing method called findTestObject that takes a string followed by an integer, which is exactly what you are trying to do:

// THIS IS WRONG!
findTestObject(emailClick, 10)

//findTestObject(<string>, <integer>)  // WRONG!

The runtime is looking at this and saying, “nope, findTestObject cannot handle this, I’m going stop the program.”

However, waitForElementPresent takes a TestObject and an integer:

WebUI.waitForElementPresent(<TO>, <integer>)

So all you’ve done is passed your 10 to the wrong method -- you passed it to findTestObject instead of waitForElementPresent. All this boils down to a misplaced closing parenthesis:

WebUI.waitForElementPresent(findTestObject(emailClick), 10)
1 Like

Russ Thomas said:

Andrew

Take more care with your method calls and their arguments. Your error is telling you what is wrong – it’s saying there is no existing method called findTestObject that takes a string followed by an integer, which is exactly what you are trying to do:

// THIS IS WRONG!

findTestObject(emailClick, 10)

//findTestObject(, ) // WRONG!


  
The runtime is looking at this and saying, "nope, findTestObject cannot handle this, I'm going stop the program."  
  
However, waitForElementPresent takes a TestObject and an integer:  
  

WebUI.waitForElementPresent(, )


  
So all you've done is passed your 10 _to the wrong method_ \-\- you passed it to findTestObject instead of waitForElementPresent.  All this boils down to a misplaced closing parenthesis:  
  

WebUI.waitForElementPresent(findTestObject(emailClick), 10)


  

  

Thank you Russ - worked as Swiss watch :slight_smile:

You helped me a lot in several topics!!!

I did lots of progress. I will zip my project to share in a day or so - just in case that you can see - i didn’t give up and your support did not go in vain :slight_smile:

Andrew