# Using groovy script on Katalon to click on row of grid

**URL:** <https://forum.katalon.com/t/using-groovy-script-on-katalon-to-click-on-row-of-grid/35818>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [November 5, 2019, 12:36pm UTC](https://forum.katalon.com/t/using-groovy-script-on-katalon-to-click-on-row-of-grid/35818 "2019-11-05T12:36:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![snehajaiswal24](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/snehajaiswal24/32/9309_2.png) [@snehajaiswal24](https://forum.katalon.com/u/snehajaiswal24)\
**Post date:** [November 5, 2019, 12:36pm UTC](https://forum.katalon.com/t/using-groovy-script-on-katalon-to-click-on-row-of-grid/35818/1 "2019-11-05T12:36:59Z")

</div>

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:

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

```

Option 2:

```auto
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:

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

```

Source Code ::

 ![xPath](https://europe1.discourse-cdn.com/katalon/original/2X/4/470b15449cea62676443d2e6fd183095870e8d81.png)

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

 ![xPath](https://europe1.discourse-cdn.com/katalon/original/2X/4/470b15449cea62676443d2e6fd183095870e8d81.png)

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]

 ![error](https://europe1.discourse-cdn.com/katalon/original/2X/c/c66d7bcd8099be635411759d2ca3eb3924f8cc55.png)

---

<div class="post-metadata">

**Author:** ![Russ\_Thomas](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/russ_thomas/32/11884_2.png) [@Russ\_Thomas](https://forum.katalon.com/u/Russ_Thomas)\
**Post date:** [November 5, 2019, 3:01pm UTC](https://forum.katalon.com/t/using-groovy-script-on-katalon-to-click-on-row-of-grid/35818/2 "2019-11-05T15:01:21Z")

</div>

This CSS will target the SPAN element you highlighted.

```auto
#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.

---

<div class="post-metadata">

**Author:** ![Russ\_Thomas](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/russ_thomas/32/11884_2.png) [@Russ\_Thomas](https://forum.katalon.com/u/Russ_Thomas)\
**Post date:** [November 5, 2019, 3:03pm UTC](https://forum.katalon.com/t/using-groovy-script-on-katalon-to-click-on-row-of-grid/35818/3 "2019-11-05T15:03:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![snehajaiswal24](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/snehajaiswal24/32/9309_2.png) [@snehajaiswal24](https://forum.katalon.com/u/snehajaiswal24)\
**Post date:** [November 6, 2019, 6:33am UTC](https://forum.katalon.com/t/using-groovy-script-on-katalon-to-click-on-row-of-grid/35818/4 "2019-11-06T06:33:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![snehajaiswal24](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/snehajaiswal24/32/9309_2.png) [@snehajaiswal24](https://forum.katalon.com/u/snehajaiswal24)\
**Post date:** [November 6, 2019, 6:33am UTC](https://forum.katalon.com/t/using-groovy-script-on-katalon-to-click-on-row-of-grid/35818/5 "2019-11-06T06:33:06Z")

</div>

Thanks ,I ll take care from next time
