Variables and Snippets

Just like steps anywhere in a robot, the steps in a snippet can use variables. The steps of Snippets are always edited inside a robot. In that context the variables defined on the robot can be used in the snippet. Reusing the snippet in another robot requires you to define the variables used by the steps in the snippet on each of the robots that uses the snippet.

A snippet can define its own variables. Open the snippet in its own editor to define variables on the snippet. If the snippet already contains steps that use variables that existed in the robot where the snippet was edited the steps are marked with a red flag.

A snippet in its own editor, that uses a variable not defined on the snippet itself.

Notice the active variables editor in the lower right corner, exactly as on robots.

If a snippet defines variables, using the snippet in a robot will automatically add the snippet variables to the set of variables of the robot.

A robot that uses a snippet that defines a variable 'url'.

As you can see the variables imported from snippets are marked in the variables list.

A robot should not contain variable definitions by the same name as variables defined in the snippets it uses. If it does so, the variable types must match. Removing a snippet from a robot also removes the variables imported by that snippet.