gotoIf (expression, label) - Selenium IDE command

gotoIf will jump to defined label if the expression is true. If the expression is false, the IDE executes the immediate next command. The expression is technically a Javascript EVAL, like in storeEval.

For more examples see the if-command page, and the internal variables !LastCommandOK and !errorIgnore.

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

GotoIf uses executeScript_Sandbox

UI Vision Selenium IDE++ (Kantu) V5.0 uses executeScript_Sandbox to evaluate the expression. The old "GotoIf" continues to use storeEval. Please read here about the difference.

In the macro source code the new version of GOTOIF is "Command": "GotoIf". The old version continues to use "Command": "GotoIf" for backward-compatibility.

GotoIf flow control - Demo Video

This video shows how to use gotoIf and storeValue to wait for the user to select a file. It loops between gotoIf...label until the length of the extracted string is greater than 1.


Click [ ] in the video player to enlarge the video.

gotoIf Example

The example below is very basic. Best if you see the flow logic in action by running the DemoIfElse macro that installs with the IDE.

Command Target Pattern/Text
open https://ui.vision/
gotoIf 8 > 5 MYLABEL
echo This line is never reached!
Label MYLABEL

Works in

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

Related Demo Macros

DemoGotoIf, 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

If-Else-Endif, gotoLabel, Label, while, endWhile, Web Automation Extension User Manual, 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.