Picture Method

Applies to TestComplete 14.0, last modified on January 23, 2019

Description

This method captures an image of visible area of the onscreen object and returns the Picture object that provides scripting interface to the captured image. You can process this object using the Log.Picture method and the image processing methods of the Regions object.

Declaration

TestObj.Picture(ClientXClientYWidthHeightMouse)

TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
ClientX [in]    Optional    Integer Default value: 0   
ClientY [in]    Optional    Integer Default value: 0   
Width [in]    Optional    Integer Default value: -1   
Height [in]    Optional    Integer Default value: -1   
Mouse [in]    Optional    Boolean Default value: True   
Result A Picture object

Applies To

All onscreen objects.

View Mode

To view this method in the Object Browser panel and in other panels and dialogs, activate the Advanced view mode.

Parameters

The method has the following parameters:

ClientX

Specifies the left coordinate of the top-left corner of the rectangular area. 0 by default.

ClientY

Specifies the top coordinate of the top-left corder of the rectangular area. 0 by default.

Width

Specifies the width of the rectangular area. The value of -1 (default) indicates that the rectangular area spreads to the right edge of the object.

Height

Specifies the height of the rectangular area. The value of -1 (default) indicates that the rectangular area spreads to the bottom of the object.

Mouse

Specifies whether the captured image will contain the mouse pointer. The default value is True and includes the mouse pointer in the image.

Result Value

The Picture object that represents the captured image.

Remarks

To capture an image of the entire visible area of the onscreen object, call Picture without any parameters.

Note that the method captures only the visible part of the onscreen object. Regions beyond the visible part are not captured. To get the image of such regions, you need to make them visible first (for example, scroll to the desired position) and then call the Picture method.

To get the image of the web page, we suggest using the PagePicture method that automatically scrolls the web page and returns the combined image.

If you have the Aero theme enabled in your system, the window images taken by TestComplete can include a useless frame around the window. To solve the issue, turn on the Disable DWM before capturing image project setting. For more information, see Capturing Images In Aero UI Theme.

Desktop testing: If TestObj refers to an object of a non-DPI-aware application running with a DPI setting other than 100%, set the ClientX and ClientY parameter values relative to the application (as if the application is running with the 100% DPI setting).

Web testing: If the Use CSS pixels for scaled pages option is enabled (by default), set the ClientX and ClientY parameter values relative to the web page, regardless of the browser zoom and the system's DPI setting.

Example

To view examples of using the Picture method, see Adding a Picture to the Test Log and Saving an Image to the Regions Collection.

See Also

Picture Object
Regions Object
MouseX Property (Desktop Objects)
MouseY Property (Desktop Objects)
PagePicture Method (Page Objects)

Highlight search results