Random Delay
Posted: Mon Aug 20, 2018 7:19 pm
This function allows you to add a random delay. To use this on your project, follow these instructions.
The following sample, if the code above is pasted under the name RandomDelay, will way for some time between 5 and 10 seconds:
Code: Select all
function (min max)
Browser.RunScript
· "return new Promise(e=>{setTimeout(()=>e(!0),argument.min+Math.floor(Math.random()*(argument.max-argument.min+1))),window.addEventListener('unload',()=>e(!1))}).then(e=>{e||global.log('Page navigated away before the delay completed!')});"
· struct
min
+
· min
· 0
max
+
· max
· 0
Code: Select all
RandomWait
· 5000
· 10000