Why can't Katalon click on my TestObject?

I have the following code:

def xpath = '//*[matches(@id,\'MessageList_DXDataRow[0-9]+\')]/td[2][text()=\'' + 
GlobalVariable.SearchData + '\']'
TestObject testObject = new TestObject()
testObject.addProperty("xpath", ConditionType.EQUALS, xpath)



For some reason it can’t click on the testObject. I have tested my xpath with an xpath validator online and it was working with static data. ( I just copied the variable-substitued xpath expression and pasted it into the validator. )


I have also added the following line of codes after the above mentioned codes:

WebElement element = WebUiCommonHelper.findWebElement(testObject, 30)
WebDriver driver = DriverFactory.getWebDriver()
JavascriptExecutor jsExecutor = (JavascriptExecutor)driver
jsExecutor.executeScript("arguments[0].click();", element)

I get the following error message:

Web element with id: '' located by 'By.xpath:
not found at 

Is there anything that i’m missing here?

matches() in XPath never works in Katalon Studio.

See the following issue:

Is there any alternative that would do the job?


try with words contains or starts-with

Yes, you can write a XPath expression using 3 functions start-with(), string-length() and substring() in combination. The following post shows an example:

The following article describes how to live without regular expression in XPath 1.0.

Is the URL of your application-under-test public on the Internet? Could you share it to us? If the URL is available to us, I could write a working sample code. Without the URL shared, I am afraid, it is difficult to discuss hands-on.