Counting elements on page


I need help with an error I am getting.
I am trying to count a specific element on the webpage and want to verify if the count is correct.
However for some reason I can’t get it seem to work.
Anyone here able to help me?

This is the piece of code.
countOfElements = WebUiCommonHelper.findWebElements(findTestObject(‘OBJECT’), 5).size()
WebUI.verifyMatch(countOfElements, ‘2’, false)

Error I am getting is;

02-19-2020 10:28:28 AM Test Cases AVB2

Elapsed time: 4,441s

Test Cases AVB2 FAILED.


groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.verifyMatch() is applicable for argument types: (java.lang.Integer, java.lang.String, java.lang.Boolean) values: [2, 2, false]

Possible solutions: verifyMatch(java.lang.String, java.lang.String, boolean), verifyMatch(java.lang.String, java.lang.String, boolean, com.kms.katalon.core.model.FailureHandling), verifyNotMatch(java.lang.String, java.lang.String, boolean), verifyNotMatch(java.lang.String, java.lang.String, boolean, com.kms.katalon.core.model.FailureHandling)



at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(

at com.kms.katalon.core.main.RawTestScriptExecutor.runScript(

at com.kms.katalon.core.main.RawTestScriptExecutor.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.runTestCaseRawScript(

at com.kms.katalon.core.main.TestCaseMain$runTestCaseRawScript$ Source)


Thanks in advance

use assert:

assert countOfElements == 2:"Error real count was : ${countOfElements}"

error you recieved means that you tried to compare integer and string … and verifyMatch() does not support integer as input:
verifyNotMatch(java.lang.String, java.lang.String, boolean),

1 Like

It works, thanks.!

any time :slight_smile: