To Verify object's property values

I have a object ‘Span_2’ where its property ‘text’ has a value=2. I wanted to pass this test if the text value=1. Please suggest how can I implement this situation in test case.

// parameters: TestObject, attributeName, expectedValue, timeout
boolean result = WebUI.verifyElementAttributeValue(findTestObject('Span_2'), 'text', '1', 10)if(!result) {    KeywordUtil.markFailed('Invalid attribute value.')}

Description from documentation:

  • Verify if the web element has an attribute with the specific name and value


    true if element has the attribute with the specific name and value; otherwise, false

WebUI.verifyElementAttributeValue(testObject, 'text', '1', 5)

1 Like

If your Span_2 Test Object is meant to reflect an HTML SPAN element, then beware – a genuine, vanilla span element does not have a text property, or, indeed, a text attribute.

It should be noted that attributes are not properties are not attributes. Katalon APIs tend to muddy the waters here.

If you want to verify the text content of an element, then use Verify Element Text.[WebUI]+Verify+Element+Text

1 Like

Thanks all! for the help. I got it now.


This is a Katalon community resource. To “pay back” for the help you received, please post your solution so that others may find it when searching for answers.