Follow Our FB Page << >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...

How to capture screen shots when an error occurs?

Answers were Sorted based on User's Feedback

How to capture screen shots when an error occurs?..

Answer / lak

Objectheirarchy.CaptureBitmap "path"

for ex

to capture any window

Window("Flight Reservation").CaptureBitmap "C:\pic1.bmp"

to capture combo box(tool)

Window("Flight Reservation").WinComboBox("Fly
From:").CaptureBitmap "C:\pic2.bmp"

This is used in QTP.

Is This Answer Correct ?    3 Yes 0 No

How to capture screen shots when an error occurs?..

Answer / uday kumar_anem

In QTP8.2, we can choose the run settings
Test -> settings -> Run tab -> set ON save image of desktop
when error occurs checkbox

In QTP 9.2, follow the below navigation:
Tools -> Options -> Run tab -> In the drop down list box "On
Error"(default) is selected for "Save step screen capture
to results"

And even we can also configure, whether we have to proceed
to next step or stop the test execution by following below
File Menu -> Settings -> Run Tab -> Choose the required
action from the "Whenever an error occurs during run
session" drop down list box.

Is This Answer Correct ?    3 Yes 0 No

How to capture screen shots when an error occurs?..

Answer / deepak k

Hi use RecoveryFunction to capture the image when error

Step1: Create a VBS file using following founction
Function RecoveryFunction1(Object, Method, Arguments,

'Find the Test Folder Path
Set qtApp = CreateObject("QuickTest.Application")
testpath = qtApp.Folders.item(1)
'stores the image inside the test folder
image_name= testpath &"\imagename.png"
Desktop.CaptureBitmap image_name
End Function

Step2: Go to Recovery manager
step3: select "On Any error" or select u r own option
Step4: select function to call
step5: call the above mentioned file

Rest QTP will do it for you

Is This Answer Correct ?    2 Yes 1 No

How to capture screen shots when an error occurs?..

Answer / ram.polavarapu

if browser("").page("").exist then
reporter.reportevent 0,"login","login is sucess"
browser("").page("").capturebitmap "b.bmp"
reporter.reportevent 1,"login","lgin is not sucess","b1.bmp"
end if

note->give the wrong psw ang you will get the result in
results window

Is This Answer Correct ?    0 Yes 0 No

How to capture screen shots when an error occurs?..

Answer / laxmi

i am unable to understand can you explain in detail

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More QTP Interview Questions

I learned all the objects of my application in object repository thru English Language. now i want to use same object repository for other languages(French,Dutuch and Chinese)

1 Answers   TCS, Wipro,

i have batch scripts in qtp and i want to update the status like pass/fail in excel sheet after excecuting the every script in to write the script for this?

1 Answers   IBM,

What is the "Release Notes", what it cosists? Key components in Release Notes ?

2 Answers  

What does it mean when a check point is in red color? what do u do?

1 Answers  

if we can find the status of script in qtp that either it's pass or fail then why we need to put this status on different excel file or log file in hybrid framework .please let me know asap thanks

1 Answers   iCreate,

Tell me Three major differences between QTP & Winrunner?

2 Answers  

How you can decide which type of object repository you have to use?

0 Answers  

How can we use the "CreateObject("Wscript.Shell")" in QTP and what is the definition and purpose of it?

2 Answers  

what is exit and entry criteria of automation testing. any body wants a real time script,please mail to me. contactno;9986435766

2 Answers  

What is the extension of script and object repository files?

4 Answers   Crea,

What are the differences between table and db checkpoints?

0 Answers  

Can any give an example(if possible templates) how to test web application using QTP. thanks in advance

0 Answers