Verify text of two matching elements


I’ve searched through this forum and used both the Verify Equal and Verify Match pages for information but can’t seem to find an answer to my rather simple query.

I have 2 elements:




What i’m trying to do is compare the two values as they are sourced from different locations though are appearing on the same page. I’ve pulled both as a test object and also converted both into a Global Variable to see if that would work but the script still fails

Both examples on the Katalon documentation seem pointless, both compare either a flat string or numerical value you specify yourself (what point does this serve btw? You’re telling the script to take String “Apple” and compare it to String “Apple” and see that it matches. Of course they will as you give both inputs manually)

If someone can please point me in the right direction in comparing either String or Numerals through Katalon that would be greatly appreciated

Edit: The error i’m getting is generic “Objects don’t match” or “Object 1 and Object 2 are not equal”

In case anyone else encounters this issue i found the solution.

The problem is that the two objects are being compared as objects, rather than the actual text that makes up the object. To get around this, I’ve used getText on the object to get the actual string that resides within this object and done the comparison on this instead.


def Card_0_Status = WebUI.getText(findTestObject(‘Automation_Objects/Card_0/Card_0_Status’))

def Card_0_CardDetails_Status = WebUI.getText(findTestObject(‘Automation_Objects/Card_0/Card_0_CardDetails_Status’))

WebUI.verifyMatch(Card_0_Status, Card_0_CardDetails_Status, false)

I am not able to do verify the things using Verify Equal and verify Match, can you please suggest how to use these 2 alerts.

You can compare those two strings directly in Java/Groovy.

String object1 = WebUI.getText(findTestObject('Object1'))
String object2 = WebUI.getText(findTestObject('Object2'))

if(object1 != object2) {
    KeywordUtil.markFailed(object1 + " and " + object2 + " do not match.")


Thanks for the response!
How can I use Verify Match alert in Manual Mode.

If both the strings are blank then whatever I pass will give me the result accordingly, is there any way, that when choosing Verify Match, user can choose the expected object from the OR.

I am attaching the screenshot for the same.

verify match.PNG


Please help me out for the above mentioned question

Ankur Solanki said:

Please help me out for the above mentioned question

You can switch to Script view and make it there, it’s easy, you should try it :slight_smile:

you can use verifyMatch Keyword for this scenario if it contains $ then it should be a String.
since Selenium will only get and pass a value as a String only.
if you are getting this value from Excel or from DB Convert the value to String Using the following example.
String a=Integer.toString(your Value here)
String a=Float.toString(your Value here)
String a=Double.toString(your Value here)
String a=Bolean.toString(your Value here)

  • you need to replace the $ using Sting.replace() in Script mode
    once you complete converting the value to String
    just concatinate it to the $

You can’t directly pass an object to verify match instead
you can getText or get Attribute from the object and store it into a local variable and pass it into the verifyMactch keyword

actual=WebUi.getText(findTestObject(“Your Object Location in object repository”))
expected=WebUi.getAttribute(findTestObject(“Your Object Location in object repository”),‘value’)


WebUi.VerifyMatch(WebUi.getText(findTestObject(“Your Object Location in object repository”)),WebUi.getAttribute(findTestObject(“Your Object Location in object repository”),‘value’),false)