Question

I'm trying to make a random wait between 30 minutes to one hour.

The code I'm using is supposed to do this, but after the last line of code the script simply stops.

Here's the script

TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:true-random-integer-generator-min CONTENT=900
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:true-random-integer-generator-max CONTENT=3600
WAIT SECONDS=1
TAG POS=1 TYPE=SPAN ATTR=ID:true-random-integer-generator-result&&TXT:* EXTRACT=TXT
SET !VAR1 {{!EXTRACT}}
WAIT SECONDS={{!VAR1}}
SET !EXTRACT NULL
Was it helpful?

Solution

'set the delay lower limit, this can be changed
SET !VAR1 1800
'set the remaining time interval that need randomized
SET !VAR2 1800
'calculate the random number
SET !VAR3 EVAL("var randomNumber=Math.floor(Math.random()*\"{{!VAR2}}\" +\"{{!VAR1}}\"); randomNumber;") 
WAIT SECONDS={{!VAR3}}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top