# Help with Randomly selecting option from list

**URL:** <https://forum.katalon.com/t/help-with-randomly-selecting-option-from-list/53903>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [April 16, 2021, 4:57pm UTC](https://forum.katalon.com/t/help-with-randomly-selecting-option-from-list/53903 "2021-04-16T16:57:07Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [April 16, 2021, 6:49pm UTC](https://forum.katalon.com/t/help-with-randomly-selecting-option-from-list/53903/2 "2021-04-16T18:49:46Z")

</div>

This might assist you. Since it is a dropdown, you probably should have just above this, `WebUI.waitForElementClickable(TO)`, to ensure it is available.

```auto
import org.openqa.selenium.WebElement as WebElement
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

def driver = DriverFactory.getWebDriver();

Random rand = new Random();

'capture all the rows associated with list'
 rows_table = driver.findElements(By.xpath('//li[@class="el-select-dropdown__item"]/span'));
WebUI.comment("Number of items: " + rows_table.size())
 upperLimit = rows_table.size();
"select one of the items"
rows_table.get(rand.nextInt(upperLimit)).click();

```

---

_[View the full topic](https://forum.katalon.com/t/help-with-randomly-selecting-option-from-list/53903)._
