How to add Random Time Delay on Web browsing

Hi,

I just created a simple Kantu script that does auto browsing on a website but I would like to add random time delay (pause) between 20 to 50 seconds, by replacing the “Pause” section.

{

“Name”: “eBay Auto Browsing”,
“CreationDate”: “2020-5-17”,
“Commands”: [
{
“Command”: “open”,
“Target”: “https://www.ebay.co.uk/”,
“Value”: “”
},
{
“Command”: “pause”,
“Target”: “10000”,
“Value”: “”
},
{
“Command”: “click”,
“Target”: “linkText=Purchase History”,
“Value”: “”
},
{
“Command”: “pause”,
“Target”: “10000”,
“Value”: “”
},
{
“Command”: “click”,
“Target”: “//*[@id="gh-la"]”,
“Value”: “”
},
{
“Command”: “pause”,
“Target”: “10000”,
“Value”: “”
},
{
“Command”: “open”,
“Target”: “Best Deals on eBay - Shop Electronics, Home, Beauty, Fashion & Toys”,
“Value”: “”
},
{
“Command”: “clickAndWait”,
“Target”: “linkText=Electronics@POS=2”,
“Value”: “”
}
]
}

Use this to wait between 1 and 60 seconds:

{
  "Command": "executeScript_Sandbox",
  "Target": "return 1000 +  Math.floor(Math.random()*60000);",
  "Value": "waittime"
},
{
  "Command": "pause",
  "Target": "${waittime}",
  "Value": ""
},

(from here: Random variable )

2 Likes

Thank you very much. That worked great but the time is in floating numbers.

What time is in float?

Never mind. I was looking for someone to help me out with my small project. Do you think you can help me out?