Nits
Nits

Reputation: 19

How to use loops in Selenium IDE

Is for loop present in Selenium IDE? if yes, How can I use it in Selenium IDE?

Thanks, Nit

Upvotes: 0

Views: 12523

Answers (2)

Nikhil Surendran
Nikhil Surendran

Reputation: 1006

We can use while loop and goto function in Selenium IDE.

For that we must install the addon flow control. Add from the following link:

Selenium IDE: Flow Control

After installing you will get the commands while and gotoif in Selenium IDE

1) Example for while loop

<tr>
    <td>getEval</td>
    <td>index = 0;</td>
    <td></td>
</tr>
<tr>
    <td>while</td>
    <td>index &lt; 10;</td>
    <td></td>
</tr>
<tr>
    <td>storeEval</td>
    <td>index</td>
    <td>value</td>
</tr>
<tr>
    <td>echo</td>
    <td>${value}</td>
    <td></td>
</tr>
<tr>
    <td>getEval</td>
    <td>index++;</td>
    <td></td>
</tr>
<tr>
    <td>endWhile</td>
    <td></td>
    <td></td>
</tr>

2) Example for gotoif

store  |  10  |  x

gotoIf | storedVars['x'] > -2 && storedVars['x'] <50  |  true

getEval| alert("Condition Fails")

gotolabel | finish

label  |  true

getEval  | alert("Condition Pass")

label  | finish


try this Thank you..

Upvotes: 2

Related Questions