简体   繁体   中英

How to change input values dynamically in selenium webdriver using Java while running the same script multiple times

Support I have run a script for the fist time to create a group with name 'Selenium Beginners'.

Then again I want to run the same script but now I want to create different group name say 'Selenium Experts' and so on.

How can I achieve this? Can anyone suggest on it.

1.Store the 'text to send' in a variable and change the value before each run

2.Create a random String and send it each time. For ex

element.sendKeys(generateRandomString());


 public String generateRandomString() {
    return "Selenium Beginners" + new BigInteger(120, new SecureRandom()).toString(32);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM