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

时间:2018-03-03 21:37:50

标签: selenium-ide imacros web-testing

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

我知道您可以使用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": ""
     }

   ]
}

1 个答案:

答案 0 :(得分:0)

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

storeEval | Math.floor(Math.random()*61)  | randomwait
pause | randomwait