No signature of method on testObject creation

In today’s episode of “what am I doing wrong?”, I am attempting to rework one of my scripts to pause a bit if this spinner image is present on a website. Note this spinner is NOT something used on all sites I am testing so if it’s not “present”, I want to break out of this routine entirely (I’m hoping it doesn’t error in that case but it probably does… :roll_eyes:)

In any case, when the following code hits the If statement, I get the No Signature of method error but I thought to was already defined as a testObject? What am I doing wrong?

Many thanks, as always!
Morgan

2019-08-02 11:54:00.930 ERROR c.k.katalon.core.main.TestCaseExecutor   - ❌ Test Cases/Common/Change Views (btnView) FAILED.
Reason:
groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.verifyElementNotPresent() is applicable for argument types: (com.kms.katalon.core.testobject.TestObject) values: [TestObject - 'objSpinner']
Possible solutions: verifyElementNotPresent(com.kms.katalon.core.testobject.TestObject, int), verifyElementNotPresent(com.kms.katalon.core.testobject.TestObject, int, com.kms.katalon.core.model.FailureHandling), verifyElementPresent(com.kms.katalon.core.testobject.TestObject, int), verifyAlertNotPresent(int), verifyElementPresent(com.kms.katalon.core.testobject.TestObject, int, com.kms.katalon.core.model.FailureHandling)
	at Change Views (btnView).run(Change Views (btnView):32)
	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:337)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
	at com.kms.katalon.core.keyword.builtin.CallTestCaseKeyword$_callTestCase_closure1.doCall(CallTestCaseKeyword.groovy:59)
	at com.kms.katalon.core.keyword.builtin.CallTestCaseKeyword$_callTestCase_closure1.call(CallTestCaseKeyword.groovy)
	at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:68)
	at com.kms.katalon.core.keyword.builtin.CallTestCaseKeyword.callTestCase(CallTestCaseKeyword.groovy:81)
	at com.kms.katalon.core.keyword.builtin.CallTestCaseKeyword.execute(CallTestCaseKeyword.groovy:44)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
	at com.kms.katalon.core.keyword.BuiltinKeywords.callTestCase(BuiltinKeywords.groovy:334)
	at Verify Add to List Increments Campaign Spends.run(Verify Add to List Increments Campaign Spends:39)
	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:337)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
	at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
	at TempTestCase1564761106223.run(TempTestCase1564761106223.groovy:21)
// Check for the spinner to not be visible - if it is, delay - if it's not, break 
for (int i=0; i<5; i++) {
	
	String xpath = 'spinnerOverlay'
	TestObject to = new TestObject("objSpinner")
	to.addProperty("xpath", ConditionType.CONTAINS, xpath)
	
	if (WebUI.verifyElementNotPresent(to)) {
		break;
	} else {
		WebUI.delay(10)
	}
}

I believe your missing an int as a timeout

2 Likes

I have not looked at the code (yet)…

A word of warning. Spinners are used to indicate a potentially long running task (like a callback to the server for more data/code/whatever). Your problem(s) will appear when you move your testing from a slower system to a faster system (and sometimes the reverse).

Here’s the ideal scenario:

  1. The network request “happens”
  2. The spinner appears and is visible.
  3. The request completes.
  4. The spinner disappears.

On a faster system:

  1. The network request “happens”
  2. The spinner appears perhaps
  3. The request completes.
  4. The spinner disappears (if it was visible)

2, 3 and 4 happen so quickly, it’s a nightmare trying to synchronize your test code with the browser UI display. This is what’s called a race condition. You can’t decide whether to code for one state or the other. And coding it leaves you wondering what the hell is going on.

If your spinner behaves in the way I’ve described (to cover network requests) I suggest you use this approach:

// Perform the action (click or whatever)
// Wait a second or two (WebUI.delay)
// Wait for the spinner to not be visible (prefer visible over present)

note: one of those rare occasions where a fixed delay is pretty much all you can do.
note2: If the spinner is not around at all, the approach still works.

1 Like

‘no signature’ usualy means you attempt to pass mismatched type to a method, or too many/less parametters than expected.
double check your code

Ah! You were right @ehernandez, I was missing an INT buuuuuut… I see what you are getting at, @Russ_Thomas. Trouble is this “spinner” isn’t on all sites (at all) where this script executes on. I’ll play around with verifyElementNotVisible using the case you referenced since you mentioned it shouldn’t matter using this method. Thanks! :beers:

That was my point with…

And if your test DOES give you any grief over checking non-visibility of missing elements, I’ll throw some JS at it.

It hates me. Not sure why. :thinking: Error logged indicates it can’t be found (correct in this case):

2019-08-02 15:36:08.421 WARN  c.k.k.core.keyword.internal.KeywordMain  - Web element with id: 'myNewObject' located by 'By.xpath: [@class="spinner"]' not found (Root cause: com.kms.katalon.core.exception.StepFailedException: Web element with id: 'myNewObject' located by 'By.xpath: [@class="spinner"]' not found
TestObject to = new TestObject('myNewObject')
String xpath = '[@class="spinner"]'
to.addProperty('xpath', ConditionType.CONTAINS, xpath)

WebUI.delay(5)
WebUI.verifyElementNotVisible(to, FailureHandling.OPTIONAL)

Okay, so since you are convinced it is NOT present…

  1. on some systems at all, and…
  2. on systems where it is used, it is not just made invisible, it’s destroyed/removed from the DOM,

go back to using verifyElementNotPresent().

Otherwise, there’s always JS.

It’s annoying that the selenium approach is so anti web standards. But that’s the world we’re forced to live in. :man_shrugging:

EDIT: Actually, waitForElementNotPresent()

1 Like

Oh yay, this is finally working. :partying_face: Thanks again for the help!

1 Like