Using groovy script on Katalon to click on row of grid

With groovy script on Katalon, I want to click on first row of grid but it is not working and it shows error (error.png with Option1 mentioned below) in console.

I have tried by targeting different element’s xpath of row but it seems click() event is not being recognized. Also, added wait and waitForPresentElement but did not work.

Following are three options I tried so far but none of them worked.

Option 1:

WebUiCommonHelper.findWebElement(By.xpath("//div[@class='dgrid-row dgrid-row-even ui-state-default']/table/tr/td/span[@class='dijitIconFlag dijitFixedMatterIcon']")).click()

Option 2:

WebUiCommonHelper.findWebElement(By.xpath("//div[@class='dgrid-row dgrid-row-even ui-state-default']/table/tr/td[contains(@class,'dgrid-cell dgrid-cell-padding dgrid-column-0-')]").click()

Option 3:

WebUI.click(findTestObject('Object Repository/Page_Law Practice Management Software  CosmoLex/td_Client Funds-Trust_dgrid-cell dgrid-cell_865aa6'))

Source Code ::

Expected Output ::
The row should be selected/clicked.

Error ::
groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.webui.common.WebUiCommonHelper.findWebElement() is applicable for argument types: (org.openqa.selenium.By$ByXPath) values: [By.xpath: //*[@id=“dgrid_1-row-9cfecd21-e608-452d-9ffc-348bd9a8b695”]/table/tr/td[4]/span]

This CSS will target the SPAN element you highlighted.

#dgrid_1 table.dgrid-row-table tr:nth-child(1)>td>span

If you use that CSS, you can get rid of WebUiCommonHelper and all that xpath stuff.

I closed your other Topic. Please don’t post the same Topic twice. Thanks.

Now I had Tried following script

Option 4:
WebUI.click(findTestObject.findXpathValue("//*[@id=‘dgrid_1-row-9cfecd21-e608-452d-9ffc-348bd9a8b695’]/table/tr/td[4]/span"))

Option 5:
WebUI.click(findTestObject.xpaths("//*[@id=‘dgrid_1-row-9cfecd21-e608-452d-9ffc-348bd9a8b695’]/table/tr/td[4]/span"))

Option 6:
WebUI.click(findTestObject.findXpath("//*[@id=‘dgrid_1-row-9cfecd21-e608-452d-9ffc-348bd9a8b695’]/table/tr/td[4]/span"))

I am getting following error on console
Reason:
groovy.lang.MissingPropertyException: No such property: findTestObject for class: Script1572862915310

Thanks ,I ll take care from next time