100% found this document useful (2 votes)
124 views

Lesson 14 Debugging and Exception Handling

The document discusses debugging tools and techniques in robotic process automation (RPA). It covers topics like exception handling, debugging panels, timing and element issues, workflow designs, and catching errors. The key points are: - It describes various debugging tools in UiPath Studio like breakpoints, locals panel, output panel, and properties inspector panel. - It explains techniques for debugging like setting breakpoints, step into, step over, and slow step to identify errors. - It discusses exception handling in RPA, different types of exceptions, and how to use try-catch, throw, and rethrow activities to catch errors. - It provides an overview of workflow designs, naming conventions, comments and annotations

Uploaded by

mutayeb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
124 views

Lesson 14 Debugging and Exception Handling

The document discusses debugging tools and techniques in robotic process automation (RPA). It covers topics like exception handling, debugging panels, timing and element issues, workflow designs, and catching errors. The key points are: - It describes various debugging tools in UiPath Studio like breakpoints, locals panel, output panel, and properties inspector panel. - It explains techniques for debugging like setting breakpoints, step into, step over, and slow step to identify errors. - It discusses exception handling in RPA, different types of exceptions, and how to use try-catch, throw, and rethrow activities to catch errors. - It provides an overview of workflow designs, naming conventions, comments and annotations

Uploaded by

mutayeb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 69

Module Objectives:

After completing this module, students should be able to:


▪ Describe various types of Exceptions and strategies to handle
them
▪ Identify Workflow Designs and usage of debugging tools.

RPA Design & Development v1.1 July 2019 1


In this lesson, we will cover the following topics:
▪ Exception Handling
• Exception
• Types of Exception
▪ Debugging Tools
• Debugging
• Panels
• Timing and Element Issues
▪ Workflow Designs
• Layout
• Choice
• Naming Conventions
• Comments and Annotations
▪ Catching errors
• Try-Catch Activity
• Throw Activity
• Rethrow Activity

RPA Design & Development v1.1 July 2019 2


At the end of this lesson, you will be able to:
▪ Define Exception handling and use of different types of
exceptions in finding errors.
▪ Use the debugging tools to locate and fix the errors.
▪ Identify the workflow designs to implement in RPA projects
▪ Use different activities in catching errors.

RPA Design & Development v1.1 July 2019 3


In this topic, we will learn about Exception and types of Exception.

RPA Design & Development v1.1 July 2019 4


An exception is an activity or an event that interrupts the normal
flow of the program when we run or execute a program. Exception
refers to the amount of deviation in the output shown from the
required business or the agreed process.
There are four types of exceptions:
▪ Time exception
▪ I/O exception
▪ User exception
▪ Class exceptions

RPA Design & Development v1.1 July 2019 5


In the software or bot programming, exception handling is a
responsive process that occurs during the execution or run-time.
Usually, developers do not want this to happen on program
compilation time so to avoid this they check and create preregister
exception that can occur.
Some exceptions are handled fairly so that the execution could start
from where it was interrupted. In short, exception handling is a
precautionary method implemented to avoid the deviations.

RPA Design & Development v1.1 July 2019 6


In UiPath, there are basically two types of exceptions:
▪ Business Exception
▪ System Exception

RPA Design & Development v1.1 July 2019 7


Business Exception
The exception that occurs in a business process is called a business
exception. The exception is dependent on the type of business.
When an exception is caused due to the current working structure, it
is termed as business exception.
Example:
If we have to download an attachment from an email, then we need
to have a unique identifier. If the subject of the email is not
standard and keeps on changing the robot will not able to pick and
this will result in a business exception. Any deviation from the
standard business rule in any process or activity is called business
exception. Hence to avoid the business exception we need to
understand the business process very carefully.
Business Rule:
In RPA, business rule is defined as a set of specific instructions on
how the input and output of data should be processed.

RPA Design & Development v1.1 July 2019 8


System Exception
Every business process that we automate requires different
applications and tools such as Microsoft office, SAP ERP, CRM, Oracle
and many more. When the normal flow of the automation process is
disrupted or stopped due to the failure of system, this is called
system exception.
Example:
It is mandatory to have Microsoft outlook to automate a business
process. The Robot picks the attachment from an email and then
downloads the same. If the outlook is not working, the robot will not
be able to open the attachment. The error caused is due to Microsoft
outlook failure and has nothing to do with the programming or
business rule hence this is categorized as System error.
A System error can be minimized by making the code error proof.

RPA Design & Development v1.1 July 2019 9


In this topic, we will learn about:
▪ Debugging and tools used in debugging process
▪ Timing issue and element not found errors and its fixes

RPA Design & Development v1.1 July 2019 10


The process of identifying error or bug in the running software or
Robot is called debugging. It ensures that the error is identified and
resolved so that it does not impact the operation and running of the
robot. It is a multi-step process that ensures that the program to
develop a software or application is perfect. Debugging helps in
maintaining the quality and continuity of the code by resolving the
errors.
There are multiple types of debugging methods such as interactive
debugging, log file analysis, unit testing, control flow analysis,
memory dumps, integration testing and profiling.

Validate is one of the key method used in UiPath to identify and


resolve the error. This includes identification of the error causing
element and then resolving them by following certain steps.

In RPA, there are six steps which are helpful in error handling:
▪ Step Into and Step Over
▪ Validate
▪ Breakpoints
▪ Slow Steps
▪ Options
▪ Logs Section

RPA Design & Development v1.1 July 2019 11


It is the most important method by which developers identify the
error or bugs in the developed code and make changes so that we
can get error-free programs.

You can use “F7 key to run the debugging process and F9 key for
breakpoint purpose”.

In the Robotic Process Automation, various tools have been


provided by UiPath Studio for debugging. These tools are helpful to
check the workflow of the programming structure and find the
exception. Apart from this, debugging also helps in checking the
execution process of each data that is validated or checked.

On Clicking “Start Debug”, three panels appear on the workstation


screen:
▪ Locals panel
▪ Output panel
▪ Properties Inspector Panel

RPA Design & Development v1.1 July 2019 12


Local Panel:
Once we click on the break, a workflow (that holds the data
variables) running in debugging mode appears on the screen. The
local panel will show the values of all variables and highlight the
recently executing activity in yellow colour which is helpful to find
the data path. However, all these things can happen only when the
data convention is assigned accurately.

RPA Design & Development v1.1 July 2019 13


The Output Panel is an essential panel in the RPA debugging. It
displays the detailed log of the current stage of workflow and the
status of all activities executed by the Robot.

RPA Design & Development v1.1 July 2019 14


The Properties Inspector Panel is used to show the active action
properties, variable values declaration and debugging in the given
data scope.

RPA Design & Development v1.1 July 2019 15


The Debugging is a feature embedded in UiPath Studio, which can
be accessed through the Execute Ribbon.
The various techniques for debugging are:
▪ Setting Breakpoint
▪ Step Into
▪ Step Over
▪ Slow Step
▪ Highlight elements

RPA Design & Development v1.1 July 2019 16


Setting Breakpoint
It is used when the user wants to pause the program at a specific
location. Once we set the toggle breakpoint to an activity, the
program will run till that activity but not execute it. Once the
execution is paused, the user can see the current value of the
variables, the current state of workflow, identify and correct the
error causing element.
The user can choose to Continue, Step Into, Step Over, or Stop the
debugging process.
Enable Breakpoint
1. Select the activity until the point which you don’t want to execute
in the project.
2. Right-click and choose toggle breakpoint.

You can continue the activity by clicking on the resume button which
can start your breakpoint activity on the last activity basis.

RPA Design & Development v1.1 July 2019 17


Here we have mentioned techniques of Debugging which you
can follow in the Debugging and Exception Handling process.

1. Step Into : It is used to start execution from the part where the
user has indicated the breakpoint.
2. Step Over: It is used to jump to the next activity from the part
where the user has indicated the breakpoint.

Note* Both the activities cannot work simultaneously, they can only
work one by one. They are used only when the user has indicated a
breakpoint.

RPA Design & Development v1.1 July 2019 18


3. Slow Step:
It is used to reduce the execution speed of the process. It helps the
user to identify each and every activity and also see the changes in
values of variables after executing every activity. It can be activated
and deactivated while the workflow is running.

4. Highlight Elements:
It shows the effect of the current application over the other
application element, while the debugging mode is on. This is only
helpful for the input and output activities.

RPA Design & Development v1.1 July 2019 19


In the automation process, there some common problem that occurs
frequently. Some common listed issues are:
1. Element not found
2. Timing Issue
Let us discuss them one by one.

RPA Design & Development v1.1 July 2019 20


This error occurs when the element, with which the Uipath is trying
to interact, does not appear on the screen, is not found or is
wrongly identified. For example, when the UiPath cannot click on
that element, get its value, or cannot enter value inside it.
The possible reasons for the occurrence of this error are:
1. Visibility of window: The visibility of the window allows the users
to interact with UiPath. The application with which the Uipath is
trying to interact with, is not visible as it is running in the
background. The best way is to ensure that the window is open
and visible.
2. Selector of the element not correct: The best way is to ensure
that the element of the selectors in UiPath is correct and is not
changing dynamically.

RPA Design & Development v1.1 July 2019 21


Steps for solving the ‘Element not found’ error:
1. UiPath can also interact with the background window but for that,
the user has to check the property simulate or send a window
message.
2. Once done, Click on “Indicate on screen“ and attach it with the
live element.

RPA Design & Development v1.1 July 2019 22


Steps for solving the ‘Element not found’ error:
3. If the selector is changing, Click on “UI Explorer” and try to find
the common properties between the two instances of the same
element.

RPA Design & Development v1.1 July 2019 23


This error occurs when the required screen takes more than the
expected time to load, due to the latency of system response or
application response time.
Let’s understand it with an example.
Suppose, we want to login into our LinkedIn profile with our
credentials. The time taken to load the LinkedIn webpage will be
dependent on the network speed of the internet, hence the lapse
time of internet will decide the execution rate of LinkedIn login.

RPA Design & Development v1.1 July 2019 24


Steps for solving the timing issue:
1. Drag the Open application activity and type the URL
“https://www.linkedin.com/”.

RPA Design & Development v1.1 July 2019 25


Steps for solving the timing issue:
2. Use the activity “Drag the Element Exists“ and highlight
“Linkedin”.

RPA Design & Development v1.1 July 2019 26


Steps for solving the timing issue:
3. Click on the property tab of the Element Exists and create a
variable with the name “Linkedin” in the output column and change
the scope from Do to Sequence.

RPA Design & Development v1.1 July 2019 27


Steps for solving the timing issue:
4. Drag an ‘if condition’ and write the condition “Linkedin = true”.

RPA Design & Development v1.1 July 2019 28


Steps for solving the timing issue:
5. Drag the Type into activity and write the username and
password.

The Benefit of Elements exist, it will wait for 30 seconds by default


for element appear on the screen So it can decrease the chances of
time issue failure. The best practice of using element exist provide
is with precautionary steps of managing the window to exist and
appear for the 30-sec default reducing the chance of failure.

Find Element: It will stop or pause until it finds a specified element on the
screen. Once it is found then it will wait for 30 seconds before throwing an error.

Wait element vanish: It will pause the process until the specified element
disappears from the screen. Once it disappears then it continues the process after
waiting for 30 sec.

RPA Design & Development v1.1 July 2019 29


After completing this topic, the students should be able to:
Use different workflow designs in RPA projects

RPA Design & Development v1.1 July 2019 30


Best Practices in UiPath
With the help of actual components of UiPath, you can understand
the best practices of debugging and exception handling features.

Workflow Designs
Workflow designs define the process of creating a project or an
activity.
The features of a workflow process are:
▪ Layout
▪ Choice
▪ Naming Conventions
▪ Comments and Annotation

RPA Design & Development v1.1 July 2019 31


Layout
It defines an activity or robotic process with the help of these
features:

A. Flowchart
Flowcharts offer flexibility for connecting activities and tend to lay
out a workflow in a plane two-dimensional manner.

B. Sequence
The sequence is a part of the simple linear process representation in
UiPath. It flows a process top to bottom and then, it follows the
scenario of other activities.

C. State Machine
It is a complex automation structure which uses the various number
of state process in the execution process. you can create any
process in a state by trigger activity which can be exited by the
same where you create a process. But when another activity is
triggered, that is the whole process is known as a state machine.
You can define the states with the help of arrows and branches in
the flowchart that is called transition. It is two types of the state
machine:
▪ Start state
▪ End state
RPA Design & Development v1.1 July 2019 32
Choice
The choice and decision workflow process implement multiple types
of conditions. It makes capable data processing and app interaction
where the robot can take any action easily by these workflow
processes.
• If Activity
• Flow Decision
• Switch Activity

RPA Design & Development v1.1 July 2019 33


If Activity:
It split the workflow sequence in the vertical form which is perfect to
long balance branches of the project. It does more content
development service when IF, ELSE and IF condition occurs on a
high level.
Solution is –
If we require to make more than one perception, then we can use
switch activity and flow decision diagram.

RPA Design & Development v1.1 July 2019 34


Flow Decision
It is best for showcasing business logic and development conditions
such as IF and IF ELSE nested constructs. Apart from this, it makes
a good sequence flowchart inside the process.

RPA Design & Development v1.1 July 2019 35


Switch Activity
Switch activity may be sometimes used in convergence with the If
operator to streamline and compact an IF… ELSE IF cascade with
distinct conditions and activities per branch.

RPA Design & Development v1.1 July 2019 36


Default Values
In the workflow, input and variable arguments have the option to be
initialized with some default static values. It comes in quite handy
when examining workflows independently process without requiring
actual input data from calling workflows or other external sources.

RPA Design & Development v1.1 July 2019 37


Naming Conventions
In the naming convention, some meaningful names allow various
types of activities, variables, workflow files, and arguments that
describe accurate activity. Apart from these, the arguments process
name always allow as a simple state that improves readability and
align the proper name convention activity.

▪ Variables must be capitalized methods, e.g. FirstName, LastName.


▪ Arguments should be in the upper Camel Case with a prefix
stating the argument type, e.g. in_DefaultTimeout, in_FileName.
▪ In the naming conventions Activities names should concisely
indicate the action taken, e.g. Click ‘Save’ Button. Retain the part
of the project title which represents the activity (Click, Type Into,
Element exists etc).
▪ Except for Main, all workflow names should contain the verb
describing what the workflow does, e.g. GetTransactionData,
ProcessTransation

RPA Design & Development v1.1 July 2019 38


Comments and Annotations
A. Context Settings
To avoid hard-coding outer settings (like file paths, URLs) in the
workflows, we suggest to keeping them in a workflow config file
(.xlsx or .xml or .json) or in Orchestrator assets if they change
often.

B. Credentials
No-one credentials should be stored in the workflow process
directly, but instead it should be loaded from safer places such as
local Windows Store or Orchestrator assets.

C. Error Handling
The two types of programming exceptions that may happen when
you run an automated process are: somewhat predictable or
unexpected.
Placing can control Exception propagation susceptible code inside
Try/Catch blocks where situations can appropriately handle. At the
highest level, the primary process diagram must define broad
corrective measures to address all general exceptions and to ensure
system integrity.
You can take vertical programming propagation mechanism to avoid
the duplicate process which wield the all exception error in an
individual place. Usually the exception and source message is the
RPA Design & Development v1.1 July 2019 39
crucial part where the source is indicating the name of activity in
case it is failed. Again the name is vital process that clear the
indication component.

D. Code Reusability
During the software or robot development we need to automate
multiple steps in the projects or workflow. So, it should be a
standard practice to create workflows that contain small pieces of
occurring automation and add them to the Library. Separating
business logic with the help of automation components is a moral
principle which is helpful to develop a code and abide to reuse in bot
development.

RPA Design & Development v1.1 July 2019 39


Few points about quality automation:
A. Modularity
▪ It allows a separation process of every concern activities with
dedicated workflows. Along with it processes a granular
development and testing process.
▪ It extracts the components and shares reusable
components/workflows between projects.

B. Maintainability
▪ Good structure and development standards

C. Readability
▪ Standardized process structure encouraging clear development
practices
▪ It has meaningful names for activities, workflow files, arguments
and flexible variables.
▪ Always lay climate setting in orchestrator and configuration
setting which is helpful to run automation procedure in testing
and production process.

D. Reliability
▪ Exception handling and error reporting
▪ Real-time execution progress update

RPA Design & Development v1.1 July 2019 40


E. Extensibility
▪ Ready for distinct use cases to be incorporated

RPA Design & Development v1.1 July 2019 40


After completing this topic, the students should be able to:
Use different activities in catching errors

RPA Design & Development v1.1 July 2019 41


Catching Errors:
This is the remedial method used in UiPath studio to identify the
reason of failure and detect the error. One of the most reliable
method that we use in UiPath is Try Catch activity. In every
automation process, user want to be able to detect the errors as
they happen and perform various actions to rectify the errors when
they occur.

1. Try-Catch Activity
It is used to recover from specific error instead of crashing and
terminating the whole workflow. The Try-Catch activity can be found
in the activities panel. To use Try-Catch activity, we will drag and
drop it inside the workflow.

RPA Design & Development v1.1 July 2019 42


For handling errors in Try Catch block, the user has to divide the
whole workflow into 3 parts:
1. Try Block: In this, the user has to put all the activities that
might throw an error. All the possible activities which you create
that cause error that's why it should be placed in the blocks
2. Catch Block: This is another very important activity to remove
the errors. It is actually called “Catches” in UiPath since user can
add multiple type of catches.
3. Finally (Optional one): It is just for the actions to be
performed after the try & catch blocks. In case of error or no
error still the finally bock will be executed.

RPA Design & Development v1.1 July 2019 43


Recognizing Error in System Exceptions
Let’s see how its works:
In this sample, we will show if any error occurs in our workflow, it
will automatically recognise that error and log a message with
circumstances surrounding that exception.
Step 1: Drag the Try-Catch activity.

RPA Design & Development v1.1 July 2019 44


Recognizing Error in System Exceptions

Step 2: Drag any sample sequence or workflow inside it.

RPA Design & Development v1.1 July 2019 45


Recognizing Error in System Exceptions

Step 3: Click on catch and choose “System. Exception” and then


press Enter.

RPA Design & Development v1.1 July 2019 46


Recognizing Error in System Exceptions

Step 4: Now user will get room automatically for the actions in the
Catch section.
Step 5: In this Catch block now you can add activities to take place
when an error occurs in the main workflow.

RPA Design & Development v1.1 July 2019 47


Recognizing Error in System Exceptions

Step 6: We should also add the log command because that gives us
an advantage if we are debugging a workflow that run unattended.
Step 7: Drag and drop the “Log Message” command inside the
Catch block and for the level we are choosing “Warn” and for the
message we are saying “an error”+exception.Message*.

Note**: exception. Message will show you the error message that
is coming.
In this project, we haven't added any activity inside the finally block
because it depends on the requirement. User can perform any task
or action in every condition, then users can drop those action in
Finally block.

RPA Design & Development v1.1 July 2019 48


Throw Activity:
It is used to throw specific type of exception that user want to throw
and in the catch it can handle that particular type of exception and
perform action that user wants to perform on that exception.

RPA Design & Development v1.1 July 2019 49


Step by Step procedure for example of Throw:
1. Drag and drop the Try-Catch activity and drag the Throw activity
inside the Try block.

RPA Design & Development v1.1 July 2019 50


Step by Step procedure for example of Throw:
2. Click on the property tab of the Throw activity and write the
exception type that user want and write the message that you
want to show in (“ ”). In this project we have written “new
NotSupportedException ("oops Error occurs")”.

RPA Design & Development v1.1 July 2019 51


Step by Step procedure for example of Throw:
3. Go to Catch block and choose the same condition that user has
written in the Throw block.

RPA Design & Development v1.1 July 2019 52


Step by Step procedure for example of Throw:
4. Drag the write line inside the Catch section block and write
“exception.Message” inside the write line block. It will show the
same message that user has written in the Throw activity.

RPA Design & Development v1.1 July 2019 53


Step by Step procedure for example of Rethrow:
1. Create two variables with the name “a” and “b” of type integer
and pass the values a =12, b =24.
2. Drag and drop the Try-Catch activity inside it and drag and drop
one more try catch activity.

RPA Design & Development v1.1 July 2019 54


Step by Step procedure for example of Rethrow:
3. Inside the inner Try block, drag and drop the If activity and pass
the condition “a mod b = 0”
4. Inside the Then block, drag the write line activity and inside the
else block drag the “Throw” activity.

RPA Design & Development v1.1 July 2019 55


Step by Step procedure for example of Rethrow:
5. Click on the property tab of the Throw activity and write the error
type “new BusinessRuleException("Non Divisible numbers")”.

RPA Design & Development v1.1 July 2019 56


Step by Step procedure for example of Rethrow:
6. Click on the Catch block and add the exception type
“BusinessRuleException” and drag the write line activity and write
message “Exception is: "+exp.Message” inside it.
7. Drag and drop the Rethrow activity after it.

RPA Design & Development v1.1 July 2019 57


Step by Step procedure for example of Rethrow:
8. Then go to the Catch block of outer Try-Catch activity and add
the exception type “BusinessRuleException”.

RPA Design & Development v1.1 July 2019 58


Step by Step procedure for example of Rethrow:
9. Drag the Write line activity inside it and write a message “A is
greater so result will be zero also" + exception.Message”.

RPA Design & Development v1.1 July 2019 59


The point of the Recap & Summary section is to go through the
most important points covered in the lesson, after the students had
the chance to see them in practice and obtain a consolidated view.

The teacher should use facilitation questions to help the students


map the key points and offer a safe space to get questions and
comments from them.

Some examples of facilitation questions:


1. What is a Business Rule Exception?
2. What is System Exception?
3. What are the steps used in debugging?
4. Name the three debugging panels.

RPA Design & Development v1.1 July 2019 60


The point of the Recap & Summary section is to go through the
most important points covered in the lesson, after the students had
the chance to see them in practice and obtain a consolidated view.

The teacher should use facilitation questions to help the students


map the key points and offer a safe space to get questions and
comments from them.

Some examples of facilitation questions


1. What is a Layout?
2. What are some of the choice/conditions?
3. What are some naming conventions followed in UiPath Studio?
4. What is Throw activity?
5. What is Re-throw activity?

RPA Design & Development v1.1 July 2019 61


Q&A
Now it’s your turn. What you have learned at the end of this lesson?

RPA Design & Development v1.1 July 2019 62


Correct answer: c) Both Business Rule Exception and System
Exception are types of exception in UiPath.

RPA Design & Development v1.1 July 2019 63


Correct answer: a) Breakpoints enables a user to pause a program
up to a specific location.

RPA Design & Development v1.1 July 2019 64


Correct answer: c) Finally is an optional Block in Try Catch activity.

RPA Design & Development v1.1 July 2019 65


Correct answer: a) True, The Throw activity is used to throw a
specific type of exception.

RPA Design & Development v1.1 July 2019 66


In the next lesson, we will be covering Project Organization.

RPA Design & Development v1.1 July 2019 67

You might also like