2

我想用循环创建测试用例。我sideflow.js在 Selenium 选项中获得了最新的扩展并针对它。然后我重新启动了 Selenium IDE,但它不起作用。

示例测试用例:

store|i|1
while|${i}<200|
echo|${i}|
storeEval|i=1*storedVars['i']; i+1|i
endWhile||

它显示以下错误消息:

[error] Unexpected Exception: fileName -> chrome://selenium-ide/content/tools.js -> file:///home/imslavko/bin/sideflow.js?1346044911197, lineNumber -> 100

Firefox 版本:Ubuntu 14.0.1

Selenium IDE 版本:1.9.0

sideflow.js:来自此页面的最新消息 https://github.com/darrenderidder/sideflow/blob/master/sideflow.js

如何让它发挥作用?提前致谢。

4

3 回答 3

2

代替

store|i|1

把它写成

store|1|i
于 2012-10-25T16:31:02.107 回答
1

如果要创建循环,建议使用以下方法。我还在学习,所以我不确定,但这对我有用。

For i=0; i <= 200; i++  i

break   "${i}" == 200   

Echo    *** "${i}" ***  

endFor
于 2012-10-27T01:35:53.597 回答
0

这是一个示例三重数组循环器(使用静态变量,因此您可以看到它的变化)

这是我定制的,注意存储增量变量的语法(如计数器等)

该循环器将循环浏览您的所有选项(在下面的示例中,有 6*5*4=120 个选项)。它会回显每个选项一次,然后移动到下一个选项。

example_array_looper
storeEval   new Date().getTime();   timeStart
echo    ${timeStart}    
storeEval   new Array("1","2","3","4"); toparray
storeEval   new Array("A", "B", "C", "D", "E"); middlearray
storeEval   new Array("i","ii","iii","iv","v","vi");    bottomarray
getEval topindex=0; 
getEval middleindex=0;  
getEval bottomindex=0;  
getEval loopCounter=0;  
while   topindex < storedVars['toparray'].length    
storeEval   topindex    temptop
while   middleindex < storedVars['middlearray'].length  
storeEval   middleindex tempmiddle
while   bottomindex < storedVars['bottomarray'].length  
storeEval   bottomindex tempbottom
echo    javascript{storedVars['toparray'][storedVars['temptop']]+" -> "+storedVars['middlearray'][storedVars['tempmiddle']]+" -> "+storedVars['bottomarray'][storedVars['tempbottom']]} 
getEval bottomindex++;  
getEval loopCounter++;  
endWhile        
getEval bottomindex=0;  
getEval middleindex++;  
endWhile        
getEval bottomindex=0;  
getEval middleindex=0;  
getEval topindex++; 
endWhile        
storeEval   loopCounter loops
echo    Total number of loops is: ${loops}  
storeEval   new Date().getTime();   timeEnd
echo    ${timeEnd}  
storeEval   (${timeEnd}-${timeStart})/1000  scriptRunTime
echo    Total Run Time for Script was: ${scriptRunTime}s    
storeEval   ${scriptRunTime}/${loops}   averageTime
echo    Average Loop Duration was: ${averageTime}s  

我选择删除所有 html 标记(因此差距应该很明显)。StoreEval 命令最适合保存循环计数器,因为您可以将它们用作一步而不是 2 的增量。

于 2015-07-07T12:59:47.457 回答