while (expression), end - Selenium IDE command

The part between while (expression) and end is executed as long as the expression is true. Technically Selenium IDE++ uses executeScript_Sandbox (Javascript) to evaluate the WHILE expression. If the he expression is false, the IDE executes the immediate next command after endWhile.

Flow control is a built-in UI.Vision RPA Selenium IDE feature. In the classic Selenium IDE you can add support for flow control by installing the Flow Control plugin.

Break and Continue

If you are working with loops, you might find it useful at some point to either break the loop when a certain condition is met or you might want to skip over one or more iterations of the loop. This is what the break and continue statements are used for.

while/end (Recreate FOR/NEXT Loop)

In this example we use the while/end construct to loop 5 times. We use executeScript_sandbox increment the Selenium IDE variable "i" in each while loop:

Use Selenium IDE WHILE/end to loop 5 times

Works in

UI.Vision RPA for Chrome Selenium IDE, UI.Vision RPA for Firefox Selenium IDE, Firefox IDE Classic

Related Demo Macros

DemoIfElse, DemoCsvSave

The ready-to-import-and-run source code of all demo macros can be found in the Open-Source RPA software Github repository.

See also

Do...RepeatIf, Times, gotoLabel, Label, storeEval, Web Automation Extension User Manual, Selenium IDE commands, Selenium IDE Flow Control (SelBlocks), Classic Firefox Selenium IDE.

Anything wrong or missing on this page? Suggestions?

...then please contact us.

<em>UI.Vision RPA</em> Selenium IDE for Chrome and Firefox - Web Test Automation
Subscribe to the UI Vision RPA software newsletter . We'll send you updates on new releases that we're working on.