Hello,
I kindly ask for your help.
I have a list of records.
I need to click random one.
Test passes without variable.
Should I add something to import java.util.concurrent.ThreadLocalRandom?
Thank you in advance!
xpath (works with number, but does not work with variable index):
//div[contains(@fxlayoutalign, "start start ")][1]/div[1]/div[${index}]/div[1]/div[1]
code:
import java.util.concurrent.ThreadLocalRandom
def index
def x = ThreadLocalRandom.current().nextInt(1, 124)
WebUI.scrollToElement(findTestObject('Smoke Test Objects/Fleet/ConstructionProjectLevel/Clickable Machine Icon'), [(index) : x], 3)
WebUI.click(findTestObject('Smoke Test Objects/Fleet/ConstructionProjectLevel/Clickable Machine Icon', [(index) : x]))
index
FAILED.
Reason:
groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.scrollToElement() is applicable for argument types: (com.kms.katalon.core.testobject.TestObject, java.util.LinkedHashMap, java.lang.Integer) values: [TestObject - 'Object Repository/Smoke Test Objects/Fleet/ConstructionProjectLevel/Clickable Machine Icon', ...]

