I wanted to create testcase with loops. I got latest sideflow.js
extension and targeted to it in Selenium options. Then I restarted Selenium IDE but it doesn't work.
Sample testcase:
store|i|1
while|${i}<200|
echo|${i}|
storeEval|i=1*storedVars['i']; i+1|i
endWhile||
It displayed the following error message:
[error] Unexpected Exception: fileName -> chrome://selenium-ide/content/tools.js -> file:///home/imslavko/bin/sideflow.js?1346044911197, lineNumber -> 100
Firefox version: 14.0.1 for Ubuntu
Selenium IDE version: 1.9.0
sideflow.js
: latest from this page https://github.com/darrenderidder/sideflow/blob/master/sideflow.js
How to make it work? Thanks in advance.
If you want to create a loop, the following is suggested. I am still learning so I am not sure but this has worked for me.
For i=0; i <= 200; i++ i
break "${i}" == 200
Echo *** "${i}" ***
endFor
Here is an example triple array looper (With static variables so you can see it changing)
This is a custom one I have made, notice the syntax for storing incremental variables (Such as counters e.t.c.)
This looper will cycle through all of your options (In the example below there are 6*5*4=120 options). It echo's each option out once and then moves onto the next one.
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
I opted to remove all the html tagging (So the gaps should be quite evident). StoreEval command is best for holding your loop counters because you can then use them as incrementals in one step instead of 2.