Variables

Variables allow you to store information that can be used throughout a flow.

For example, variables can be used to store information from the the page (e.g. Get Element Text) and pass it into other commands.

Naming

All Browserflow variables start with the prefix $, as in $selector. This naming convention allows Browserflow to differentiate between variables and normal text.

For example, running Type Text with the message Hi $name will cause Browserflow to replace $name with the value for the variable and leave the "Hi" portion intact.

Caveats

Due to this naming convention, extra processing is required if you want to append text directly to a variable.

For example, suppose you have a variable named $time that holds a value like 9:30. If you wanted to show an alert with the message The time is 9:30AM, you may try setting the message field to The time is $timeAM. However, this wouldn't work because Browserflow would look for a variable named $timeAM rather than append "AM" to a variable named $time.

In order to get the formatted text, create a new variable using Run Script. In this case, you can run it with the code const $formattedTime = $time + "AM"; and set the alert message to The time is $formattedTime.

Last updated