Help with Randomly selecting option from list

Hello Team,

I need help with randomly selecting an option from list. The list can have upto 70 options and I want to randomly select one option.

Can someone please help me ?

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

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();