Problem
It is by default not possible to add flow-control or conditional statements to our Selenium IDE tests. They came up with an excellent flow-control user-extension for Selenium IDE, that makes it possible to add conditional statements to the tests. This recipe shows us how to integrate flow-control in our tests.
Prerequisites
We have to make the flow-control user-extention available in Selenium IDE by loading the file into the IDE. The flow-control user-extension can be downloaded from the following location: http://wiki.openqa.org/display/SEL/flowControl
Solution
This user-extension provides a couple of logical functions, like: label, goto, gotoIf and while loops. We can define points in our tests to navigate to. We can place the label command in front of a selection of code.
| Command | Target | Value |
| label | name_of_label |
There are two ways to navigate to the labeled selection of code. We can make a conditional statement or we can just jump to that selection. The first table shows the goto command and the second table shows a conditional statement.
| Command | Target | Value |
| gotolabel | name_of_label |
| Command | Target | Value |
| gotoIf | Conditional statement | name_of_label |
We have also the ability to make a conditional loop, a while-loop.
| Command | Target | Value |
| while | Conditional statement | |
| //Script within the while-loop | ||
| endWhile | ||
