Error handling in UFT – Part 2

In Part 1, we have learnt how to handle and capture the run time errors. Now, we will see how to handle if any exception occurs.

Exception are nothing but the errors which we don’t know in advance. It will interrupt the normal flow of the execution.We will get surprised during execution of the program when exceptions are popped up.
E.g. A pop up for connecting the Printer, any pop up which appears sometime during application opening etc.

We call it as exception handling as well.
How to handle this kind of exceptions?

UFT provide an in-built facility to handle these kind of exception. This is achieved by utility called ‘Recovery scenario’.

You can access it at ‘Resources –> Recovery scenario manager’. Click on the button ‘New scenario’  as shown in the picture below.
Recovery scenarion manager

Welcome Window: It is a ‘Recovery scenario Wizard’ window. Which tells you about the guidelines for creating recover scenarios.

Recover wizard

Click Next.
Trigger Window: It will ask you to select the triggering event out of the 4 events mentioned, which is nothing but the issue you are facing like if a pop window appears suddenly, if you want to handle the scenario ‘object not found’ or any test Run error’ and if application crashes in any case.


Select the desired trigger event and click on Next. As we have selected, Pop up window,So on the next screen it will give us the option to capture the Pop up window. You can see at the below screen , there is a hand shape button available. You need to click on that and it will help you to capture the intended window. It will capture the window details like its title, text if any and we can use regular expression as well for any dynamic text.

Specify recovery


Recovery Window: After capturing details, click on Next. Then, next screen will ask you to select the Recovery Operation. This operation will take you to next 3 screen to capture recovery operation. Let’s see.
Recovery Operation

Click on Next. Below window will appear.This screen will give you the options to select the operation type you want to perform like perform any keyboard or mouse operation, close application etc.

Recovery Operation 2


We have selected ‘Keyboard or mouse operation’. Click Next. The next window will ask you to select a specific operation you want to perform. We have selected ‘Click button with a label’.By using Hand shape button, we have selected the button on the pop up window, for which we are creating the recovery scenario. You can see, it has captured the button with label as “GO’.

Recovery Operation 3


Click Next. It will show you the window with your selected operation. Window also has one check box which offers you to select another operation. If you want to select another operation then check it , otherwise uncheck it.

Recovery Operation 4

Post Recovery Operation:  This window gives you the options to select the operation you want to perform after recovery. You have options to executing the same step again in the code and continue or Proceed to next step or stop the test run etc. You can refer the below screen to see all the options available.

Rec scenarion 5

Click on Next.
Name Window :On the next window, you can provide the scenario name and any description if you want.

Rec operation 6

Click on Next.
Finish Window: This window will show all the settings and operation you have selected for the recovery scenario.
It also shows 2 options.

  • Add scenario to current test: This recovery scenario will be attached with your current test.
  • Add scenario to default test settings: This will become the default settings. When ever you create new Action Script, by default this recovery scenario will be attached to that.

Click Finish. It will show that recovery scenario has been added to ‘Recovery scenario manager’.

Rec operation 7

Once you click on close, it will ask you to save the recovery scenario in the system. Save it and it will be saved with extension ‘.qrs‘.

Rec operation 8

Now, you can check that recovery scenario will be added to your test. It will be seen in the solution explorer as well as in ‘File –> Settings–> Recovery (Tab)’.

In this Recovery tab, you have options to activate recovery scenario at defined steps like ‘On every step’,’On error’ and ‘Never’.

Rec operation 9

Ask Question
 If you have any doubt, You can ask a question by going to ‘Features –>Q&A Forum –> Ask Question’.
Avatar photo

Shekhar Sharma

Shekhar Sharma is founder of This website is his window to the world. He believes that ,"Knowledge increases by sharing but not by saving".

You may also like...