0% found this document useful (0 votes)
22 views14 pages

Exception Handling

Uploaded by

rutujadumbre204
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODP, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views14 pages

Exception Handling

Uploaded by

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

Academy

Exception Handling
Exception Handling - Agenda

● Output Methods

★ Best Practices
Exception Handling Situations
Addressing Exceptions in development

Exceptions need special attention during the development phase

There need to be recovery options for as many potential errors as possible

Debugging and testing should be done to minimize the error rate

Error Reporting During Deployment

During deployment, unforeseen errors will require human intervention

Understanding these errors can help administrators fix them quickly


Exception Handling Activities
The most common activity is Try Catch, it monitors a block of activities and ‘catches’
exceptions to be processed:

Activities to be covered
with exception handling

Exception Types to be
handled:
Activities that will be ● Exception Type
executed no matter what ● Response Activity
Exception Handling Activities
Rethrow - When a workflow invokes another workflow that has an exception,
rethrow will throw the exception from the inner one to be handled in the main one

Terminate Workflow - Halts the workflow and terminates it

Throw - Create and throw an exception, to be used directly in the workflow


Common Exceptions
Object reference not set to an instance of an object.

Thrown when a variable has not been initialized (has no value). Make sure the variable has a value before using a
method on it.

Index was outside the bounds of the array. Index out of range.

Thrown in an attempt to access array or collection elements with an index that is outside its capacity, e.g. getting
an element of a list without checking if the list contains items

Cannot find the UI Element corresponding to this selector.

Occurs when the selector used to identify the element does not match any element on the screen. To debug, you
need to inspect the target application and observe if the element exists.
Common Exceptions
Image was not found in the provided timeout.

Occurs when an image is can’t be identified because it is: not visible in foreground, the image resolution is
slightly different due to environment settings or elements are in different state.

Text was not found.

Occurs in text-based automation activities. Text needs to be on the screen when the activity is reached.

Click generic error. Cannot use UI_CONTROL_API on this UI node. Please use
UI_HARDWARE_EVENTS method.

Occurs when a click could not be executed. Happens when using SimulateClick or SendWindowMessages options
in an application window that does not support them.
Automation Challenges
Timing Issues:

Unexpected behavior is likely to occur when the application is not in the state the
workflow assumes it to be.
Watch for is the time the application takes to respond to workflow Interactions using the
TimeoutMS and WaitForReady properties.
A delay activity can be used to delay the next activity if it should not be executed
immediately.
Automation Challenges
Input Method Issues:

Each input method has its own particularities and can trigger a different behavior to the
target application.
Coordinates Issues:
Coordinates are relative to the target but it’s recommended to use them as little as
possible in situation where the layout of the application changes between instances.
Extra measures may be needed to maintain the layout of the application.
UI Synchronization
Useful activities for checking application UI status

FindElement, Element Exists, Wait Element Vanish


Image Exists, WaitImageVanish, FindOCRTextPosition
On Element Vanish, On Image Vanish
Delay Before, Delay After
Debugging Techniques
Debug Mode

This allows the user to track the workflow variables and path as it is being executed

Activities will be highlighted as they are executed

Slow step slows down the debug execution speed

Breakpoints can be toggled on activities to stop the debug execution when it reaches them

Output Panel

Activities: Log Message, Write Line

Log messages with process feedback can be written throughout the workflow so they can be reviewed in the
output panel afterwards
Best Practices
Use LogMessage to trace execution status

When starting and ending sequences

When taking decisions

While looping

Catch all exceptions and treat them in appropriate contexts


Global Exception Handling

The Global Exception Handler is a type of workflow designed to determine the project’s
behavior when encountering an execution error. Only one Global Exception Handler can
be set per automation project.
The Global Exception Handler has two arguments, that should not be removed.
1. errorinfo : The first argument is errorInfo with the In direction and it stores information
about the error that was thrown and the workflow that failed.
2. Result : The second argument, result has the Out direction and it is used for
determining the next behaviour of the process when it encounters an error.

After the error : We will have CIRA activity



Continue

Ignore

Retry and

Abort
Choose the action to be taken after the Global Exception Handler steps in:

Continue - The exception is re-thrown.

Ignore - The exception is ignored, and the execution continues from the next
activity.

Retry - The activity which threw the exception is retried.

Abort - The execution stops after running the current handler.

You might also like