If

This activity helps the user to make decisions based on a specified condition.
It provides a way to create branching logic, enabling the robot to adapt
dynamically based on the outcome of the condition evaluation.

Key characteristics

·         The If-Else activity evaluates a specified condition. If the condition is true,
the activities within the "Then" section are executed. If the condition is false,
the activities within the "Else" section (if provided) are executed.

·        The "Then" section represents the set of activities to be executed if the
condition is true. The "Else" section (optional) represents the set of activities
to be executed if the condition is false.

·         If needed, If-Else activities can be nested, allowing for more complex
decision-making structures within the workflow. This is achieved by placing
an additional If-Else activity within the "Then" or "Else" section of another.

Technical Reference

 

 

 

MISC

Condition: This indicates the condition to be met while the sequence of actions is executed.

 

You can either provide the values hardcoded in “Boolean” format or enter the values in “Boolean” datatype.

This field accepts the values in “Boolean” datatype.

DisplayName: Displays the name of the activity. The activity name can be customized which will help in troubleshooting.

Represents mandatory fields to execute the workflow

Here’s an example of how the activity is used in the workflow –

In the following example, I am going to automate a simple use case with
“WebAutomation” to find out whether the element exists on the page and proceed
further with “IfElse” activity.  Here I am using the “ https://www.sutherlandglobal.com/
link to detect the “ContactUs” button.

Steps to execute the bot

1.       Open an existing solution or create a new workflow.

2.       Install the “WebAutomation” feature from the “Manage” features.

3.       Drag and drop the “ElementExist” activity to the workflow and set it as
start node.

 

 

4.       Here I have already launched to the website.

5.       Double  click on the activity to detect the element.

a.       Here, choose the "Select Element" option.

b.       Detecting over the “ContactUs” button.

c.       Once you have chosen the button, the element’s value will be stored in the
"Spy" window, along with an "image" of the application.

d.       If you wish to add or remove any attributes, you can edit the "Attributes
Editor." In this case, we are not making any changes in the “Editor.”

e.       Once you click on the "Save" button, the element’s values will be stored
in the activity window.

 

6.       Now, navigating to the “ExistStatus” in the properties to declare a
variable to view the output of the activity.

a.       There are two methods to store the spied value in the variable.

b.       Method 1: Double-click on the variable parameter “ExistStatus” in the
“Output” section and enter a name that helps you easily identify it in the flow.
Here, I'm using the name "Exists" and using the shortcut key "Ctrl+Q" to
create the variable.

 

c.       Method 2: Click on the variable pane, enter your preferred name
(here, I'm using "Exists"), and choose the data type as "Boolean" since
the output value accepts the boolean data type.

7.       Then, adding the “If” activity from the “ControlFlow” feature.

a.       Here I am using this activity to check whether the value exists when the
website is launched, based on the output, the bot will make decisions.

b.       Double click on the activity and here I am providing the “Condition” as
“Exists”.

 

8.       Now, In the “Then” branch, I am adding a write log to write the success
message if the element exists on the website.

 

9.       In the “Else” branch, I am adding the “BrowserControl” activity from the
“WebAutomation” feature.

a.       Here I am providing the “URL” as the website URL -
https://www.sutherlandglobal.com/.

b.       Choosing the “ActionType” as “Refresh” from the drop-down as here I am
trying to refresh the browser if the element is not found.

10.   Now, save and execute the workflow.

Below is the sample output of the activity.

 

The bot executes the activity, applies the given condition to the input
given by the user and gives the desired output.