How to add random numbers to your code?

How to add random numbers to your code?

I have used this but it throws an error.

import org.apache.commons.lang.RandomStringUtils as RandStr

Random rand = new Random ();
upperLimit = 9999999
icnt = rand.nextInt(upperLimit);

WebUI.setText(findTestObject(Object Repository/Page_/input_acc_account_acc_num), icnt)

@abdibaitelis1, you can check this thread How do I set a random number in a text field? for some suggestions to try.

1 Like

When you say it throws an error, it would be good if you mentioned what error it threw. It likely was MissingMethodException because you have an Integer instead of a String as the second parameter. You should change the statement to:

WebUI.setText(findTestObject('Page_/input_acc_account_acc_num'), icnt.toString())