Do...Repeat If (expression) - Selenium IDE command

The part between Do and Repeat If (expression) is executed as long as the expression is true. RepeatIf uses executeScript_Sandbox to evaluate the expression. If the he expression is false, the IDE executes the immediate next command Repeat If.

UI.Vision reuses the established Selenium IDE flow control syntax

What is the difference between While... End and Do...RepeatIf?

The difference is that "While" is a top tested loop (test the condition first then do loop), but do...repeatIf is a bottom tested loop (do the loop then test the condition). So in worst case scenario, the loop instructions inside the while are not be executed at all, but the loop instructions inside repeat loop are always executed at least once.

Note that UI.Vision and Selenium IDE use RepeatIf and not RepeatUntil as in some other scripting languages.

Do/RepeatIf Example

The example below is very basic.

Command Target Pattern/Text
echo This command is executed once!
Repeat If 100 < 5

Works in

UI Vision for Chrome Selenium IDE, UI Vision 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 Github repository testmacros folder.

See also

gotoLabel, Label, While, executeScript, Web Automation Extension User Manual, Selenium IDE commands, Selenium IDE Flow Control (SelBlocks).

Anything wrong or missing on this page? Suggestions?

...then please contact us.

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