Selenium IDE Loop Example

Selenium IDE is no doubt a great tool for basic automation purpose. It provides many commands which can be used in our day-to-day automation activities. However it is missing a looping feature out of the box. We can add looping functionality in Selenium IDE by using an extension called Flow Control. In this post, we will see how we can implement Selenium IDE loop with a simple example.

Google search page is used as an example here. We will see how Flow Control extension can be used to navigate to Google Advertising and About Google pages multiple times. Before we proceed, let’s first of all see how we can configure Flow Control extension with Selenium IDE. Follow below steps for that.

  • Download Flow Control JavaScript file from here.
  • Open Selenium IDE.
  • Navigate to Options–>General tab.
  • Locate the downloaded JavaScript file in Selenium Core Extensions section.
  • Click OK button.
  • Once this extension is configured, you should be able to see goto, gotoIf and while commands in Selenium IDE.

Below image shows Selenium IDE commands to navigate to Google Advertising and About Google pages.Selenium IDE Loop

In the image above, label command is used to create label called ‘openGoogle’. At the end of the script, gotoLabel command sends control to label named ‘openGoogle’. Apart from these, below are details of additional commands from Flow Control extension.

  • gotoIf | expression – Jump to specified label if expression is true
  • while | expression – Loop while expression is true
  • endWhile – Indicate the end of a while loop
  • push | value | arrayName – Push value onto an array, creating array if necessary

You can also check out below image which shows extensive use of the commands listed above.Side Flow

We hope the above example would be helpful in understanding how Selenium IDE Loop can be implemented. Let us know your views on this. If you like this article, consider subscribing to our feed.

Comments
  1. Patricia
  2. Paul
  3. Ahsan
    • Harry
  4. Diogo
  5. Seb
  6. smith
  7. Martha Dimple Mohan
  8. Connor Roberts
    • Cristiano Araujo

Leave a Reply

Your email address will not be published.