When we use 'ERR' object to handle the exceptions in the
script, do we need to include any statement in the
beginning of the script..??

Answers were Sorted based on User's Feedback



When we use 'ERR' object to handle the exceptions in the script, do we need to include a..

Answer / uday kumar _ anem

Generally, when QTP encounters a run time error during
running the scripts, it shows the error message in a pop up
window and the script execution will stops.

If you wish to display your own error message and you wish
to continue with the script, then we will use Err object.

We have to use "On Error Resume Next" statement before the
runtime error is returned.

The general usage of the Err object is like:

On Error Resume Next

dim fileSysObj
fileSysObj=createobject("Scripting.FileSystemObject")

fileSysObj.folderexists("c:\uday") 'assume this folder
doesnt exist
'QTP shows the error message here itself and stops
execution, if "On Error Resume Next" statement doesnt exists


If Err.Number <>0 then
msgbox("Here it prints") 'Because of Err object we can give
our own error message
end if

Is This Answer Correct ?    1 Yes 1 No

When we use 'ERR' object to handle the exceptions in the script, do we need to include a..

Answer / nath t

Yes u have to mention "On Error Resume Next" statement in
the beginning of the script

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More QTP Interview Questions

How can you find Local Host Name by Using QTP?

4 Answers  


Scripts for Ascending order in qtp.

3 Answers  


What is the difference between Datadriven and Parameterization?

8 Answers   Ordain Solutions,


write a script to validate the content in the web application. (do it by OR method) and (do it by Descriptive method by creating a description object..

0 Answers  


give me the code to save all messages of inbox of gmail into a folder and notepad

0 Answers   Infosys,


How would you export a script from one pc to another in qtp?

0 Answers  


i've installed qtp9.2 on Windows 7. Recording and everything no problem. But when i am saving the test, it is not happening. it says 'general error while saving'. But teh test is getting saved but as a folder with lock icon. When i wanted to open it, it is jst showing as a locked folder but not as a test. Somebody help me out plz

1 Answers  


How to use setroproperty?

0 Answers  


what is risks of testing a project?

5 Answers   AppLabs,


I want to test my vb.net solution file using qtp. Does Qtp test only .exe file?

0 Answers  


How vl i prioritize the actions when i have 10 actions A1, A2, A3......A10. I want to run action as follows A1,A5,A6 and A10. How i can do it. Thanks in Advance to u.

7 Answers   IBM, Wipro,


How to remove associated function library?

0 Answers  


Categories