I'm trying to make a very simple script with a nested while loop in Selenium IDE which will eventually be used to print all elements in a matrix.
I start by initialising two variables 'i' and 'j' to 0, I then start the first loop to run while i<3, I then start another loop to run while j<3 inside this loop and increment each at the end of each loop.
The numbers printed should read; 0 0, 0 1, 0 2, 1 0, 1 1, 1,2, 2 0, 2 1, 2 2
However I only seem to be able to complete the inner loop once, so am only getting: 0 0, 0 1, 0 2
Thee code I am using is here;
<tr>
<td>store</td>
<td>0</td>
<td>i</td>
</tr>
<tr>
<td>store</td>
<td>0</td>
<td>j</td>
</tr>
<tr>
<td>while</td>
<td>${i} < 3</td>
<td></td>
</tr>
<tr>
<td>while</td>
<td>${j} < 3</td>
<td></td>
</tr>
<tr>
<td>echo</td>
<td>${i} ${j}</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>new Number(storedVars['j'])+1</td>
<td>j</td>
</tr>
<tr>
<td>endWhile</td>
<td></td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>new Number(storedVars['i'])+1</td>
<td>i</td>
</tr>
<tr>
<td>endWhile</td>
<td></td>
<td></td>
</tr>
Does anyone know how to fix this or have a work around? I assume the issue comes from losing the variable at the end of a loop however I'm not sure, this would be so easy in C!
Thanks, J
You can try a workaround using nested gotoIf/label