4

In R selenium it is possible to set a time sleep like this:

Sys.sleep(15)

How is it possible to set a random time? In python it is like this:

time.sleep(random.uniform(3.5,6.9))
Berbery
  • 287
  • 1
  • 3
  • 11

2 Answers2

4

Sys.sleep(sample(1:10, 1))

Should solve the problem

Bharath
  • 1,401
  • 12
  • 21
1

In Java Selenium 2.x, you can use Sleeper.sleepTight(randomDurationInMS). You probably have access to the same Sleeper class in your R bindings.

I think Selenium 3.0 (when it finally comes out) will get rid of that class though, but maybe something will replace it.

djangofan
  • 25,461
  • 54
  • 171
  • 262