A
A
Alena2015-03-24 15:13:52
Java
Alena, 2015-03-24 15:13:52

How to specify random value in autotest?

Good afternoon!
I broke my whole head and would be very grateful for a hint.
Here is an excerpt from my test. At the moment when sendKeys("123456789") - how to force the program to enter a random value and it doesn't even matter what length.
=(

@Test
  public void testUntitled() throws Exception {
    driver.get(baseUrl + "/login.html");
    driver.findElement(By.id("login")).clear();
    driver.findElement(By.id("login")).sendKeys("cmd9999adm");
    driver.findElement(By.cssSelector("input.largeButton")).click();
    driver.findElement(By.cssSelector("div.actions > input[type=\"button\"]")).click();
    driver.findElement(By.id("patientCode")).clear();
    driver.findElement(By.id("patientCode")).sendKeys("123456789");

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
anyd3v, 2015-03-24
@Kossmmooss

Integer.toString(new Random().nextInt())
something like this

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question