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)
WebUI.delay(2)
WebUI.click(testObject)
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. )
Edit:
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:
com.kms.katalon.core.webui.exception.WebElementNotFoundException:
Web element with id: '' located by 'By.xpath:
//*[matches(@id,'MessageList_DXDataRow[0-9]+')]/td[2][text()='F-03836/2020']'
not found at
Is there anything that i’m missing here?