run (macro name) - Selenium IDE command

Through the use of the run | Folder1/Folder2/macro command you can re-use one macro (test case) inside of another. For example, this allows you to re-use a "Login Macro" as building bloc in multiple other macros.
Important: Folder and file names are case-sensitive. When you use the hard-drive storage, note that file paths are relative to the macro root directory.

Demo: In the Ui.Vision RPA demo macros the DemoCsvReadWithLoop and DemoCsvReadWithWhile macros both use run to call Sub_DemoCsvRead_FillForm. This subroutine is responsible for the form filling part, which is the same in both demo macros.

Another demo can be found in DemoXDesktopAutomation and DemoXDesktopAutomation_OCR. These macros both call Sub_XDesktopAutomation_Area. This subroutine is responsible for limiting the vision search area.

How is the subroutine related the main program?

  • - Variables are visible in the subroutine. (Do not confuse this with global variables, which are visible even between macros.)
  • - If the value of a variable is changed in the subroutine, it changes the value in the main macro, too ("Call by reference").
  • - For internal variables the same rules as for variables apply, with one exception: !macroname is always the macro name of the main macro.
  • - !runtime is the overall runtime (main program and subroutine runtime is counted together)
  • - VisionLimitSearchArea restrictions are handled just as internal variables

Tip: Another way to combine several macro (tests) into one is the use of test suites.

RUN command with macros in folders

RUN supports macros in folders. It understands absolute and relative paths:

  • - RUN | /reuse/logins/gmail/user1 => Path from root folder (top folder)

  • - RUN | gmail/user1 (no / at the start!) => Relative path from current folder of the macro

Summary: Absolute paths start with a / and relative paths not.

RUN Example

The example below is very basic. Best if you see the RUN command in action by running the DemoCsvReadWithWhile macro that installs with the IDE. DemoCsvReadWithWhile uses RUN to call the form filling subroutine inside a WHILE loop. In the log file this is indicated by the line "[status] Running 'Sub_DemoCsvRead_FillForm', called by 'DemoCsvReadWithLoop'".

Command Target Pattern/Text
open https://ui.vision/
run /reuse/login_macro
echo Now we are logged in!
run /reuse/logout_macro

Works in

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

Related Demo Macros

DemoCsvReadWithWhile, DemoCsvReadWithLoop, DemoXDesktopAutomation, DemoXDesktopAutomation_OCR (these macros all use RUN)

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

gotoLabel, Label, storeEval, 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 RPA</em> Selenium IDE for Chrome and Firefox - Web Test Automation

Fresh from the Ui.Vision Forum: The Latest 3 Topics. Join the discussions:

← Meet the Ui.Vision team and users in our forums.