QTP – Image Capture in QTP

By | February 20, 2010
Image Capture in QTP:

Followings is the method to capture any image from webpage:

MyObject.CaptureBitmap “Image.bmp”

Following are the steps that you need to perform to use capturebitmap method,

  • Record the image that you need to capture. i.e If you want to capture the “google” fromg google homepage than you just need to click on that image.
  • After clicking, you will get one line of code like following,
  • Browser(“Google”).Page(“Google”).Image(“Google”).click
  • Modify above line of code to following,
  • Browser(“Google”).Page(“Google”).CaptureBitmap “C:\GoogleImage.bmp

And execute it, you will get “Google” image in “GoogleImage.bmp” file under “c:” directory.

  • If you want to capture whole screen of desktop, that also you can do using this method, following is the example to achieve it,
  • Desktop.CaptureBitmap “c:\DesktopImage.bmp”
  • You can also save Image .Png format using capturebitmap method in QTP.
If you like this article, You can subscribe through mail.

Leave a Reply

Your email address will not be published. Required fields are marked *