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..??

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Are Shared ORs read-only?

624


wt is the use of multiple questions in QTP

1673


What is meant by Step generator?what is the use of this? we have 3 steps know there what r all those.? can u all pls give me clear idea of this

1401


Hi, Can anyone please tell me how to connect the QC with QTP using QTP script? Thanks in advance

1519


If I am scripting Web-based Surveys using QTP that open up differently but at the exact same point require a username and password can I automate that username and password for all the surveys some how using QTP?

1433






What is the syntax to call one script from another? And what can be the syntax to call one “action” in another?

701


Explain different recording modes?

579


How to find the path of folder in which the test is saved in qtp?

532


What test you perform mostly? Regression or retesting in your testing process?

574


Hello, Is there any way to send the test results in html format (or any other) by email using outlook after the test run ends? thank you in advance

1738


distinguish between old version and new version QTP features.

1861


I want to know what are QTP functons and what are VB script functions. What is the difference between them.When we have to use these functions.

1298


What if recovery scenarios is also failed for identify the alert ? (We are handling unexpected popup through recovery scenarios but if still recovery scenarios also failed than what should be the approach)

1009


what is the hierarchy to use properties in descriptive programming

1496


How to find the length of the string in qtp?

576