Hello Everyone,
I have a below piece of code which is basically deciding the length phone number digits and then entering phone number based on that length.
int Select_phonestring_lenght = new Random().nextInt((10 - 1) + 1) + 1
for (int Enter_Phone_Number = 0; Enter_Phone_Number < Select_phonestring_lenght; Enter_Phone_Number ++) {
def phonestring = org.apache.commons.lang.RandomStringUtils.randomNumeric(1)
WebUI.sendKeys(findTestObject('Customer_Information_Page/Field_Phone'), phonestring)
}
Within this for loop, I also want to save the value of variable phonestring in another variable but I am not sure how to do that because according to my understanding the second time the loop will run it would delete the value already stored in that variable.
The reason I want to store the phonestring in a variable is because in the next steps I am trying to concatenate all those variables and match with the number that was expected.