Tuesday 26 November 2013

How to take a screenshot in QTP?

In QTP, when we execute the test cases, test cases may fail due to valid / invalid defects. They may also fail due to script issues or any other issues like network failure.

After the test execution ends, We only have the html reports or QTP results with us which does not give clear picture about the status of application. To solve this problem we can take the snapshot of the application when any test step fails.

Example - Below code will take the screen shot. You can insert this code anywhere you want to take the screen shot.

Window("xyz").CaptureBitmap "c:\screenshots\abc.png",True
'In above code we are storing the png image file to c drive location. Second parameter tells whether to overwrite existing file.

Thus you can use capturebitmap method of any object to take the screen shot.


Please give your inputs, suggestions, feedback to Us about above QTP topic. We value your thoughts.

No comments:

Post a Comment

Please Leave your reply. We value your feedback and inputs

Best QTP Books

Everything About QTP

Hello Friends,
You can find QTP study material, Multiple choice questions (mcq), QTP question bank, QTP question papers, QTP notes, QTP questionnaire, scenario based QTP interview questions, QTP tutorial and QTP training on this site.

If you are a fresher or experienced QTP professional with (1/2/3/4) years of experience, this blog is just for you.