lundi 29 mai 2017

How to setup Thread.sleep to be a random number (Selenium Java)

Quite simple question, however, I have trouble with this. I want to use sleep.thread to click on buttons in a random range of numbers, for example 30-50 seconds. This must be a sleep command. There is a loop that clicks on the elements and my attempt to do that(I found this in another answer, not working for me)

List<WebElement> textfields = driver.findElements(By.className("_84y62"));


    System.out.println("total buttons " + textfields.size());

        for (WebElement e : textfields) {
            e.click();

                Thread.sleep((long)(Math.random() * 11 + 10));
            }




Aucun commentaire:

Enregistrer un commentaire