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

how can we test the Triggers, Cursors, Indexes while doing Database testing in DTP??

1590


I need to pull the data from the page which in row, column vice into excel sheet, how can it be done using QTP? eg: Name Dept xyz gdty i need the same data to be exported in excel sheet.

1729


Is there anyway to automatically update the Datasource name in Database Checkpoints object when we migrate tests to a new release?

3275


How QTP identify the system time that's changes every seconds?

598


What are the five challenges you faced in QTP?

2754






In the website, the protocol has been changed http: to https what you will do? Tell me your approach?

563


Difference between test object and run time object?

596


Give the syntax to load function at run time.

631


Explain how Selenium is different from UFT?

697


What is Associate Repository in QTP 9.2 ?

605


How to use Environment parameterization? Explain with an example.

1484


How to get the format of a webedit class in qtp. How can i know that particular webedit accept what type of format like "mm/dd/yyyy" or "$" or Alphanumeric

1645


How will you report the bug and explain the defect tracking sheet you handled?

2558


Why do you create a text checkpoint on a Web application? What is the purpose of the Close method?

1362


which type of testing process are you following in ur company? how to recognize a qtp page?

1409