Finding part of an attribute value

Hi! There are my first steps with Katalon - link to docs as an answer is ok too:)

I’m trying to find a part of an attribute value: i.e. H1 has class=“a b c”. Finding of “a b c” is no problem, got it. But if i’m searching for

_WebUI.verifyElementAttributeValue(findTestObject(‘t1/t1-h1’), ‘class’, ‘a’, 0) /*without backspace after a*/
_
or

_WebUI.verifyElementAttributeValue(findTestObject(‘t1/t1-h1’), ‘class’, 'a ', 0) __/*with backspace after a*/
_the finding fails.

How should i search for partial attribute values correctly?

You probably want to verify via a regular expression: https://docs.katalon.com/display/KD/[Common]+Verify+Match

First, get the content of the class using https://docs.katalon.com/display/KD/[WebUI]+Get+Attribute and store it in a variable. Then use Verify Match on the variable.

If you have issues using the Verify Match approach, use a regex and call into JavaScript: https://docs.katalon.com/display/KD/[WebUI]+Execute+JavaScript

1 Like

got it - thanks! this kind of chaining seems to be one of main approaches - very good to know at the very beginning:)

You’re welcome. And thanks for the BA B)