Hi all,
We are excited to announce the release of a new feature in Macros: Conditionals.
This introduces a new type of step in Macro, the Conditional (If..Else
). It allows you to execute specific steps based on wether a condition evaluates to true
or false
. This is similar to the If..Else
structure in programming languages.
if ( this expression evaluates to true) {
//Execute these of steps
} else if ( this other expression evaluates to true) {
// Execute these other steps
}
Example Use cases:
- Handling Popups: On certain page loads, a popup may appear while at other times it doesn’t. If your macro has a step to click on the close button of the popup, it might encounter errors if the popup is absent. To address this, you can set a Conditional to click the popup’s close button only if the popup is present. Reference to a similar query can be found in this thread:
- Login if not already logged in: Execute a list of steps to login, only when you are prompted to login. If you are not prompted to login (because you are already logged in), these steps are automatically skipped.
The following video shows how to use Conditionals to skip a step when not needed.
The content in the demo page is accessible only after user clicks on the Agree
button. Once agreed, the button is no longer visible until the cookie expires. We create a macro that clicks the button when present and skip when it it is not.
https://www.loom.com/share/bead83d7b2ec46178beac6f275ba7d1e?sid=118f75d1-3402-4b85-84e2-54c92bc8ff81
Please share your thoughts and feedback.
Future developments:
- Make it easier to move steps in and out of Condition block.