Micro Focus QTP (UFT) Forums
How to write scripts with error handling mechanism - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: How to write scripts with error handling mechanism (/Thread-How-to-write-scripts-with-error-handling-mechanism)



How to write scripts with error handling mechanism - UFT_Newbie - 08-04-2014

Hi Guys,
I've to write automation script for web based application which will be run on IE, Chrome and FF. Can you help me with error handling code. For ex. if i want to capture screenshot of error and have it continue to next function. Can someone please give ideas on what i could do and how could i do it so any time i've errors, i can quickly and efficiently debug them?

Your replies are very much appreciated.

Thanks


RE: How to write scripts with error handling mechanism - ankur1601 - 08-11-2014

whenever u want to capture a screen shot of error, then write a function when u recieve any error and use Desktop.capture.
for next line you can use On error Resume Next


RE: How to write scripts with error handling mechanism - UFT_Newbie - 08-14-2014

Thanks Ankur!

But how can i do that if i've multiple actions in my script ?? Do i've to write that code for every action or there's a more dynamic way to do this ?