# Collect the List of WebElements

**URL:** <https://forum.katalon.com/t/collect-the-list-of-webelements/33275>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [September 18, 2019, 7:00am UTC](https://forum.katalon.com/t/collect-the-list-of-webelements/33275 "2019-09-18T07:00:56Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![sarath.g](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@sarath.g](https://forum.katalon.com/u/sarath.g)\
**Post date:** [September 18, 2019, 7:00am UTC](https://forum.katalon.com/t/collect-the-list-of-webelements/33275/1 "2019-09-18T07:00:56Z")

</div>

Hi,

Scenario: Collect the list of elements and get the size of elements and perform actions on that.

I had collected a list of elements by using:

List listofelements = WebUI.findWebElements(findTestObject(‘Locator’))  
for(int i=0;i\<listofelements.size();i++)  
{  
if(listofelements.size()\>0)  
{  
WebUI.click(findTestObject(‘Locator’))  
}  
}

Is this correct approach for my scenario please help with this… ???

---

<div class="post-metadata">

**Author:** ![ThanhTo](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/thanhto/32/697_2.png) [@ThanhTo](https://forum.katalon.com/u/ThanhTo)\
**Post date:** [September 18, 2019, 7:06am UTC](https://forum.katalon.com/t/collect-the-list-of-webelements/33275/2 "2019-09-18T07:06:11Z")

</div>

Seems valid to me. Please try it out to see if it works and then post the result back.

---

<div class="post-metadata">

**Author:** ![sarath.g](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@sarath.g](https://forum.katalon.com/u/sarath.g)\
**Post date:** [September 18, 2019, 8:12am UTC](https://forum.katalon.com/t/collect-the-list-of-webelements/33275/3 "2019-09-18T08:12:46Z")

</div>

I am getting following error when running the code.

Reason:  
groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.findWebElements() is applicable for argument types: (com.kms.katalon.core.testobject.TestObject) values: [TestObject - ‘Object Repository/Homepage/closetabs’]  
Possible solutions: findWebElement(com.kms.katalon.core.testobject.TestObject), findWebElements(com.kms.katalon.core.testobject.TestObject, int), findWebElement(com.kms.katalon.core.testobject.TestObject, int)

---

<div class="post-metadata">

**Author:** ![Marek\_Melocik](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/marek_melocik/32/371_2.png) [@Marek\_Melocik](https://forum.katalon.com/u/Marek_Melocik)\
**Post date:** [September 18, 2019, 8:14am UTC](https://forum.katalon.com/t/collect-the-list-of-webelements/33275/4 "2019-09-18T08:14:05Z")

</div>

You miss some parameter in _findWebElements_ method - TestObject and integer is expected (timeout?)

---

<div class="post-metadata">

**Author:** ![sarath.g](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@sarath.g](https://forum.katalon.com/u/sarath.g)\
**Post date:** [September 18, 2019, 8:50am UTC](https://forum.katalon.com/t/collect-the-list-of-webelements/33275/5 "2019-09-18T08:50:29Z")

</div>

Now i used the following i am getting different error

List listofelements = WebUiBuiltInKeywords.findWebElements(findTestObject(‘Locator’),30)

Reason:

groovy.lang.MissingPropertyException: No such property: WebUiBuiltInKeywords for class: Script1568722606904  
at caseCreation\_UpdateCase.run(caseCreation\_UpdateCase:33)  
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)  
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)  
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337)  
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)  
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)  
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)  
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)  
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)  
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)  
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)  
at TempTestCase1568796438785.run(TempTestCase1568796438785.groovy:21)

---

<div class="post-metadata">

**Author:** ![Marek\_Melocik](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/marek_melocik/32/371_2.png) [@Marek\_Melocik](https://forum.katalon.com/u/Marek_Melocik)\
**Post date:** [September 18, 2019, 8:51am UTC](https://forum.katalon.com/t/collect-the-list-of-webelements/33275/6 "2019-09-18T08:51:39Z")

</div>

Most probably missing import (don’t you use WebUI alias?)

---

<div class="post-metadata">

**Author:** ![sarath.g](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@sarath.g](https://forum.katalon.com/u/sarath.g)\
**Post date:** [September 18, 2019, 8:56am UTC](https://forum.katalon.com/t/collect-the-list-of-webelements/33275/7 "2019-09-18T08:56:40Z")

</div>

I edited it and kept as WebUI instead of WebUiBuiltInKeywords… i am getting missing method exception. What is meant by missing method exception???

---

<div class="post-metadata">

**Author:** ![HeleneB](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/heleneb/32/2775_2.png) [@HeleneB](https://forum.katalon.com/u/HeleneB)\
**Post date:** [September 18, 2019, 9:05am UTC](https://forum.katalon.com/t/collect-the-list-of-webelements/33275/8 "2019-09-18T09:05:59Z")

</div>

Share the logs, and script with the imports

---

<div class="post-metadata">

**Author:** ![sarath.g](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@sarath.g](https://forum.katalon.com/u/sarath.g)\
**Post date:** [September 18, 2019, 9:16am UTC](https://forum.katalon.com/t/collect-the-list-of-webelements/33275/9 "2019-09-18T09:16:07Z")

</div>

import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint  
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase  
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData  
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject  
import org.openqa.selenium.WebElement as WebElement  
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint  
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW  
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile  
import com.kms.katalon.core.model.FailureHandling as FailureHandling  
import com.kms.katalon.core.testcase.TestCase as TestCase  
import com.kms.katalon.core.testdata.TestData as TestData  
import com.kms.katalon.core.testobject.TestObject as TestObject  
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS  
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI  
import internal.GlobalVariable as GlobalVariable

WebUI.openBrowser(‘[https://xyz.com](https://xyz.com)’)

WebUI.maximizeWindow()

WebUI.sendKeys(findTestObject(‘Login/username’), ‘xyz’)

WebUI.sendKeys(findTestObject(‘Login/password’), ‘xyz’)

WebUI.click(findTestObject(‘Login/loginbtn’))

WebUI.delay(35)

WebUI.waitForElementPresent(findTestObject(‘Homepage/elementpresent’), 10)

//WebDriver driver = DriverFactory.getWebDriver()

List pending = WebUI.findWebElements(findTestObject(‘Object Repository/Homepage/closetabs’),30)

for (int i = 0; i \< pending.size(); i++) {  
if (pending.size() \> 0) {  
WebUI.click(findTestObject(pending))  
}  
}

* * *

* * *

Console Report:

groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.testobject.ObjectRepository.findTestObject() is applicable for argument types: (java.util.ArrayList) values: [[[[CChromeDriver: chrome on XP (345d6d71ff5f726a1af2544d70761961)] -\> xpath: //\*[@data-key=‘close’]], …]]  
Possible solutions: findTestObject(java.lang.String), findTestObject(java.lang.String, java.util.Map)  
at caseCreation\_UpdateCase.run(caseCreation\_UpdateCase:37)  
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)  
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)  
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337)  
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)  
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)  
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)  
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)  
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)  
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)  
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)  
at TempTestCase1568796767592.run(TempTestCase1568796767592.groovy:21)

---

<div class="post-metadata">

**Author:** ![HeleneB](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/heleneb/32/2775_2.png) [@HeleneB](https://forum.katalon.com/u/HeleneB)\
**Post date:** [September 18, 2019, 9:23am UTC](https://forum.katalon.com/t/collect-the-list-of-webelements/33275/10 "2019-09-18T09:23:24Z")

</div>

You try to find a List of elements :

> [@sarath.g](#):
>
> No signature of method: static com.kms.katalon.core.testobject.ObjectRepository.findTestObject() is applicable for argument types: (java.util.Array **List** )

> [@sarath.g](#):
>
> **List pending** = WebUI.findWebElements(findTestObject(‘Object Repository/Homepage/closetabs’),30)
> 
> for (int i = 0; i \< pending.size(); i++) {  
> if (pending.size() \> 0) {  
> WebUI.click(findTestObject( **pending** ))  
> }  
> }

But I can’t understand what you’re trying to do. Your List pending is a List of WebElements, so you can’t use the WebUI.click method, because it works with TestObject

---

<div class="post-metadata">

**Author:** ![sarath.g](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@sarath.g](https://forum.katalon.com/u/sarath.g)\
**Post date:** [September 18, 2019, 9:30am UTC](https://forum.katalon.com/t/collect-the-list-of-webelements/33275/11 "2019-09-18T09:30:45Z")

</div>

Actually after login into application there will be some tabs opened some times or there will be no tabs in that application. so i’m getting close buttons of that tabs in the list and putting in for loop all buttons and if buttons size \>0 then we must click on that close tab button.

So, this is the scenario…

---

<div class="post-metadata">

**Author:** ![HeleneB](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/heleneb/32/2775_2.png) [@HeleneB](https://forum.katalon.com/u/HeleneB)\
**Post date:** [September 18, 2019, 9:32am UTC](https://forum.katalon.com/t/collect-the-list-of-webelements/33275/12 "2019-09-18T09:32:50Z")

</div>

Try

```auto
for(int i = 0; i < pending.size(); i++) {
    if(pending.get(i).size() > 0) {
        pending.get(i).click()
    }
}

```

---

<div class="post-metadata">

**Author:** ![sarath.g](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@sarath.g](https://forum.katalon.com/u/sarath.g)\
**Post date:** [September 18, 2019, 9:36am UTC](https://forum.katalon.com/t/collect-the-list-of-webelements/33275/13 "2019-09-18T09:36:04Z")

</div>

Sure, I will try give me 1 min.

---

<div class="post-metadata">

**Author:** ![sarath.g](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@sarath.g](https://forum.katalon.com/u/sarath.g)\
**Post date:** [September 18, 2019, 9:45am UTC](https://forum.katalon.com/t/collect-the-list-of-webelements/33275/14 "2019-09-18T09:45:15Z")

</div>

yeah, thanks for the logic i changed some of that and tried it worked for me.

List pending = WebUI.findWebElements(findTestObject(‘Object Repository/Homepage/closetabs’), 30)

int closetabsSize = pending.size()

if (closetabsSize \> 0) {  
for (int i = 0; i \< closetabsSize; i++) {  
pending.get(i).click()  
}  
}

---

<div class="post-metadata">

**Author:** ![sarath.g](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@sarath.g](https://forum.katalon.com/u/sarath.g)\
**Post date:** [September 18, 2019, 9:58am UTC](https://forum.katalon.com/t/collect-the-list-of-webelements/33275/15 "2019-09-18T09:58:12Z")

</div>

So, I am getting some errors in mobile testing at the starting stage could be able to help with that?

---

<div class="post-metadata">

**Author:** ![HeleneB](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/heleneb/32/2775_2.png) [@HeleneB](https://forum.katalon.com/u/HeleneB)\
**Post date:** [September 18, 2019, 10:05am UTC](https://forum.katalon.com/t/collect-the-list-of-webelements/33275/16 "2019-09-18T10:05:19Z")

</div>

Please, open a new topic on the Mobile category (with your scenario, the script, and the error log). There the mobile specialists can help you

---

<div class="post-metadata">

**Author:** ![sarath.g](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@sarath.g](https://forum.katalon.com/u/sarath.g)\
**Post date:** [September 18, 2019, 10:06am UTC](https://forum.katalon.com/t/collect-the-list-of-webelements/33275/17 "2019-09-18T10:06:48Z")

</div>

Sure thank you…

---

<div class="post-metadata">

**Author:** ![pvulimiri](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/pvulimiri/32/20464_2.png) [@pvulimiri](https://forum.katalon.com/u/pvulimiri)\
**Post date:** [September 8, 2022, 12:58pm UTC](https://forum.katalon.com/t/collect-the-list-of-webelements/33275/18 "2022-09-08T12:58:47Z")

</div>

Hi All

I am facing the same issue and was unable to resolve it. Can anyone help me?

This is the error I am facing:  
groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.sendKeys() is applicable for argument types: (org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringWebElement, java.lang.String) values: [[[ExistingRemoteWebDriver: on ANY (6e75c30c06b5f5965053381924cce209)] → xpath: //div[@id=‘QuickResponseGrid’]/div[3]/table/tbody/tr/td[16]], …]  
Possible solutions: sendKeys(com.kms.katalon.core.testobject.TestObject, java.lang.String), sendKeys(com.kms.katalon.core.testobject.TestObject, java.lang.String, com.kms.katalon.core.model.FailureHandling)  
at Quote Creation LTL-MB.run(Quote Creation LTL-MB:149)  
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)  
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)  
at com.kms.katalon.core.main.RawTestScriptExecutor.runScript(RawTestScriptExecutor.java:34)  
at com.kms.katalon.core.main.RawTestScriptExecutor.doExecute(RawTestScriptExecutor.java:29)  
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:415)  
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:407)  
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:284)  
at com.kms.katalon.core.main.TestCaseMain.runTestCaseRawScript(TestCaseMain.java:179)  
at com.kms.katalon.core.main.TestCaseMain$runTestCaseRawScript$0.call(Unknown Source)  
at TempTestCase1662639900055.run(TempTestCase1662639900055.groovy:307)

---

<div class="post-metadata">

**Author:** ![aldogondolegit](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/aldogondolegit/32/28974_2.png) [@aldogondolegit](https://forum.katalon.com/u/aldogondolegit)\
**Post date:** [February 20, 2023, 10:20am UTC](https://forum.katalon.com/t/collect-the-list-of-webelements/33275/19 "2023-02-20T10:20:35Z")

</div>

can you show us the code?

---

<div class="post-metadata">

**Author:** ![grylion54](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/grylion54/32/16265_2.png) [@grylion54](https://forum.katalon.com/u/grylion54)\
**Post date:** [February 20, 2023, 4:27pm UTC](https://forum.katalon.com/t/collect-the-list-of-webelements/33275/20 "2023-02-20T16:27:48Z")

</div>

> [@pvulimiri](#):
>
> groovy.lang. **MissingMethodException** :  
> **Possible solutions** : sendKeys(com.kms.katalon.core.testobject. **TestObject** , java.lang.String)

The fix to the problem is right in the message. The OP just didn’t have the correct parameters.
