Random Delay

Premades & Resources to be used with Helium Scraper 3
Post Reply
webmaster
Site Admin
Posts: 491
Joined: Mon Dec 06, 2010 8:39 am
Contact:

Random Delay

Post by webmaster » 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.

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
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

RandomWait
   ·  5000
   ·  10000
Juan Soldi
The Helium Scraper Team

Post Reply