Choose several filters randomly and loop back


I am considerably new on Katalon and have been testing it for almost 2 weeks now. There is something that i need to do in a script, but cannot find the tutorial for it or any documents that can help with this. Probably already exists, please sorry for my question if it does and would be good if you could point me out for the solution…if not, here it is my question:

I need the script to make 2 specific actions.
I have a page where i have 2 drop down menus and then a button, “calculate” On the page when select 1 option from the first menu and other option from the second menu, it will filter and show me some data related to those options…the idea is for the script to choose randomly options from the 2 menus and test it out and calculate to show the data from the selected options.
The second action is that to do this in loop mode, going back to the step where it will choose the options (after it calculates and show the results).

So basically on the line 42 & 45, i want it to choose randomly from the options it has calculate and show results (on line 50) and then go back to the line 42, and go over the process again. Repeating the steps, lets say, 10 times.

The “loop” could be done with a simple “for” statement, such as:

for (int icnt = 0; icnt < 10; icnt++) { }

The random factor can be done similar to the following:

The concern I see is what are the contents of the second drop-down. You may be able to set up your contents of drop-downs in a “case” blocks like the example in the sample, or just add a constant sum to the first random amount to get a second or even set up a second random function.

Random rand = new Random();
upperLimit = 10;  // what are the number of items in the first drop-down
"do loop 10 times"
for (int icnt = 0; icnt < 10; icnt++) {
     choice = rand.nextInt(upperLimit);

     WebUI.selectOptionByValue(findTestObject('TO'), choice.toString(), false)
     WebUI.selectOptionByValue(findTestObject('TO2'), (choice + 1196).toString(), false)


I have to ask why are you using the boolean in your selectOptionByValue as true. You don’t have any RegEx within the text, so you should have the boolean as false.

Hi! Thanks for your reply. That was Katalon that auto add the true while recording the script. I will try your solution above. Thank you