Selenium IDE:有没有办法在点击之间添加随机延迟?

问题描述 投票:0回答:1

有没有办法在点击之间添加随机延迟?

我知道你可以使用PAUSE添加固定延迟,但有没有办法添加,例如,1秒到60秒之间的延迟,以进行真实的网络测试?

{
   "CreationDate": "2018-03-03",
   "Commands": [
     {
       "Command": "click",
       "Target": 
"//*[@id=\"application\"]/div[3]/div/div/div/div/div/div/div/div/freelancers-search/div/div[2]/section[1]/div/div/article/div[3]/div/div[1]/div/div/div/button/span",
       "Value": ""
     },
     {
       "Command": "click",
       "Target": 
"css=button.btn.btn-primary.col-xs-12.m-0-left.m-md-top.m-0-bottom",
       "Value": ""
     },
     {
       "Command": "click",
       "Target": 
"//*[@id=\"application\"]/div[3]/div/div/div/div/div/div/div/div/freelancers-search/div/div[2]/section[4]/div/div/article/div[3]/div/div[1]/div/div/div/button/span",
       "Value": ""
     },
     {
       "Command": "click",
       "Target": 
"css=button.btn.btn-primary.col-xs-12.m-0-left.m-md-top.m-0-bottom",
       "Value": ""
     }

   ]
}
selenium-ide imacros web-testing
1个回答
0
投票

你首先在1到60之间使用use STOREEVAL to generate a random number,然后将其用作PAUSE的输入:

storeEval | Math.floor(Math.random()*61)  | randomwait
pause | randomwait
© www.soinside.com 2019 - 2024. All rights reserved.