Getting a Check Box's Image

Applies to TestComplete 14.30, last modified on November 21, 2019

While testing check box controls, you can use specific properties and methods of the corresponding program object to perform certain actions and obtain data stored in controls. You can call these methods and properties from your keyword tests, as well as from scripts. This topic describes how to work with the needed properties and methods from your scripts. However, when testing a control from your keyword test, you can use the same methods and properties calling them from keyword test operations. For more information, see Keyword Tests Basic Operations.

The check box controls you are working with can have images. If you need to get an image, you can obtain it by using the wImage property. This property belongs to the Win32CheckBox object, which is associated with standard Windows check box controls during the test run. The wImage property returns the Picture object that contains the control’s image (for more information about the Picture object, see the Picture Object topic). The code snippet below copies a check box’s image to the clipboard:

JavaScript, JScript

...
bImage = Sys.Process("MyApp").Window("MainWin").Window("MyCheckBox");
Sys.Clipboard = bImage.wImage;
...

Python

...
bImage = Sys.Process("MyApp").Window("MainWin").Window("MyCheckBox")
Sys.Clipboard = bImage.wImage
...

VBScript

...
Set bImage = Sys.Process("MyApp").Window("MainWin").Window("MyCheckBox")
Set Sys.Clipboard = bImage.wImage
...

DelphiScript

...
bImage := Sys.Process('MyApp').Window('MainWin').Window('MyCheckBox');
Sys.Clipboard := bImage.wImage;
...

C++Script, C#Script

...
bImage = Sys["Process"]("MyApp")["Window"]("MainWin")["Window"]("MyCheckBox");
Sys["Clipboard"] = bImage["wImage"];
...

See Also

Working With Check Box Controls
wImage Property (CheckBox Controls)
Picture Object

Highlight search results