How to click on an element random times using selenium. Is it possible to that using selenium.
Asked
Active
Viewed 397 times
-1
-
Possible duplicate of [Generating random integers in a specific range](http://stackoverflow.com/questions/363681/generating-random-integers-in-a-specific-range) – JeffC Jun 24 '16 at 02:14
1 Answers
1
You can just use a simple loop
for this in which you use the click()
method to click on the button on each iteration.
WebElement button = // Find your element here
Random rand = new Random();
int n = rand.nextInt(50);
while n > 0 {
button.click();
n--;
}

RemcoW
- 4,196
- 1
- 22
- 37