Wednesday, February 13, 2008

Selenium IDE Flow Control - Goto and While Loops


This extension provides goto, gotoIf and while loop functionality in Selenium IDE. Selenium IDE is a plugin for Firefox that automates the testing of web-based applications. There is an excellent flow-control extension at for the Selenium RC and TestRunner components, but it does not work with Selenium IDE (the Firefox plugin) directly. This makes it difficult to develop controlled test cases within Selenium IDE, and there are times when the frame-based TestRunner cannot be used (such as when the website under test employs a frame-buster script).

I've ported the existing control-flow extension to work in the Selenium IDE Firefox add-on. The image below shows a sample test case using goto, gotoIf and a while loop, all running successfully in Selenium IDE.

The file can be downloaded from Github and should be saved as "sideflow.js" to your hard drive. Then the Options settings in Selenium IDE should set the Selenium Core extensions to include the path of this file, similar to the image below.

I've published the extension on github.  Go ahead and download it from there.

Update 26 February, 2008:
This mod of the FlowControl extension works only with the Selenium IDE Firefox add-on. If you want to use the TestRunner component or Selenium RC, please use the original FlowControl extension.

Update 19 February 2011

I've moved the extension over to github

Update 7 July 2011
I've updated the example to use the newer syntax required in the latest versions of Selenium IDE.

Please note that if you are using Selenium RC, you should use the original flow-control plugin here:

Unfortunately I haven't had the time or the need to make this compatible with both Selenium RC and Selenium IDE.  Please feel free to fork the code on github and make a pull request if you would like to help out.

Update 24 July 2012
I added a "push" command to the plugin, with a simple example on the Github page. This allows you to easily create a collection of items and implement "for each"-style functionality to iterate over it. Here's the original announcement


«Oldest   ‹Older   201 – 204 of 204
Anonymous said...

Can I know how to write commands to a practical scenario using gotoIf and while in selenium IDE

John E. said...

I am trying to run my test suites through the command prompt while using extensions from user-extensions.js, but I keep getting one of two errors:

1 - unknown command 'gotoif'
2 - specified label 'NEXT81' is not found

These tests run perfectly through IDE, but once I try to execute from command prompt they fail at the 'gotoif' commands. PLEASE HELP ME!

John E.

Darren said...

As the blog post describes, this extension is a port of the original flow control extension for selenium RC. It is not compatible with Selenium RC and is only for use in Selenium IDE (the firefox plugin). If you want to use flow control on the command, use the original flow control library for Selenium RC. I don't know if it is still supported or works with the latest version of Selenium, however. You may want to consider alternatives like Mocha and Slimer.JS

Fabio Natale said...

Hey guys, can someone please help me?

I wanna create a while loop over all my testcases, but when my endWhile command is not in the same case there occurs following problem:
"There was an unexpected error. Msg: Error: non-matching while/endWhile found"

Does anyone have a solution for my problem?

«Oldest ‹Older   201 – 204 of 204   Newer› Newest»