Galactic Civilizations 3
Use a loop in Selenium

Use a loop in Selenium

Category: Javascript.
Posted by on the 06/05/2014.
Last update on the 06/05/2014.

   Next tutorial>>


This tutorial explains how to use loops in your Selenium scripts.


This tutorial requires that Selenium IDE is installed. It also requires that the plugin flowControl is installed. This tutorial has been done with Firefox. This tutorial can be realized with a simple text editor like « Notepad ».

While loops

To write while loops, we need to use the « while » and « store » commands.

  • while will be used for the condition of the loop;
  • store will be used to increment the i parameter;

Here is an example on how to use a while loop:

store | 0 | i
while | storedVars.i < 10
echo | ${i}
store | javascript{storedVars.i++}

NB: The incrementation of i can also be done like this:

storeEval | ${i}+1 | i

Selenium using a while loop

The boolean operators that can be used in the condition ( while(...) ) are:

  • and: &&
  • or: ||
  • not: !
  • less than: <
  • greater than: >
  • less or equal: <=
  • greater or equal: >=
  • equal: ==
  • different: !=

You like this tutorial ?
Like this website in order to promote it on facebook !

   Next tutorial>>

You like this tutorial ? Share it with your friends !
Partager sur Facebook Partager sur Twitter Partager sur Myspace Partager sur Stumbleupon Soumettre sur Reddit Partager sur Digg Ajouter à vos favoris Technorati Ajouter à vos favoris Live Ajouter à vos favoris Google Ajouter sur vos favoris Yahoo