Hello,
@emine
How could i use random function to click on one item of this menu in my test cas.
thank you for helping please.
Hello,
@emine
How could i use random function to click on one item of this menu in my test cas.
thank you for helping please.
Can I suggest putting the xpaths of the components into a List and then randomly selecting one of them. Or, create a CASE block, one for each component, based on a number and then randomly have one of the pathways selected.
Thank you for reply
if you can give me some of the code because i could not follow all what you said.
iām new comer in katalon studio, this kind of stpes, is new for me too.
i was thinking something like this:
Random rand = new Random();
upperLimit = 4;
icnt = rand.nextInt(upperLimit);
switch (icnt)
{
case 0:
WebUI.click(findTestObject('Inbox'))
break;
case 1:
WebUI.click(findTestObject('LC 4/27'))
break;
case 2:
WebUI.click(findTestObject('DC 2/13'))
break;
case 3:
WebUI.click(findTestObject('BG 1/5'))
break;
default:
WebUI.comment("Whoops")
break;
}
Thank you brother.
so i will put this code after recording my login steps ?
You would put this code where you want to click on the particular menu item. If you do your testing from the Manual tab, then insert some comment that you can search for in the Script tab at the appropriate location.
Ok bro i will give you a feedback.
thank you again for helping.
hope this works for me
hello @ferrariklersone
Add the xpath information of your buttons to a list. I can suggest you a code process like the one below.
List<TestObjects> randomObjects = Arrays.asList(findTestObject('Path/To/TestObject1'), findTestObject('Path/To/TestObject2'), findTestObject('Path/To/TestObject3'))
Random rand = new Random()String
randomPath = randomObjects.get(rand.nextInt(randomObjects.size()))WebUI.click(findTestObject(randomPath))