Post Screenshot Operation

Applies to TestComplete 14.72, last modified on April 22, 2021

Description

Use the Post Screenshot operation to post images to the test log. To specify the image to be logged, you can do any of the following:

  • Specify the full name of the window or control, whose image you are going to post.

  • Specify the script code that returns the desired window or control, or specify the variable or parameter that holds the window (or control) reference.

  • Specify the variable, parameter or script code that returns a reference to a Picture object.

This image will be displayed in the Picture pane of the test log when the message is selected in the log.

Operation Result

When you post a screenshot to the test log, TestComplete creates an image file and then adds the file reference to the log. The operation returns the fully-qualified name of this file.

Scripting Analogue

The operation performs the same action as the Log.Picture method.

Child Operations

The operation cannot have child operations.

Operation Parameters

The operation parameters are organized into the following pages:

Select Object

On this page you can select the object whose image will be logged:

Object

Specifies the window, control or its area whose image you wish to post to the log.

Note for mobile testing: To post the image of a tested mobile object, specify the desired object by selecting it on the Mobile Screen (make sure the Mobile Screen is visible upon selecting the object). Note that the mobile application, to which the target object belongs, and the mobile device, where the application is running, must be prepared for testing.

You can specify the object in one of the following ways:

Tips for selecting objects:

  • You may find the second technique more convenient than using the target icon, because you can manipulate applications before actually selecting an object. For example, you can open the tested application window containing the desired control and so on. Unlike using the target icon, with this technique, you can point to popup windows, tooltips, and other objects that are hidden in the application when being inactive.

  • Instead of selecting the object, you can copy its name from the Object Browser, Object Spy, keyword test, or script code beforehand and paste it into the Object box.

  • Despite the way you specify the object name, you can change or correct it directly in the Object box.

Note: To post a screenshot of the entire desktop, type Sys.Desktop or Sys.Desktop.Picture() in the Object box.

In the Preview area, you can preview the captured image. To highlight the selected object on the screen, click Highlight.

If the Map object names automatically setting is enabled, TestComplete will automatically create a mapped name for the selected object (if it does not have one yet) and display this name instead of the default one in the Object box.

Specify the Message’s Text and Details

On this page, you can specify the image description:

Message

Specifies the text to be posted to the test log along with the image. This text will be displayed in the Message column of the test log.

Details

Specifies an additional information to be posted to the test log along with the image. This information will be shown in the Details panel of the test log when the image is selected.
Operation Parameters

On this page you can view and modify all of the parameters of the operation:

Picture

A constant, variable, test parameter or the [Last Operation Result] value that contains one of the following:

  • The full-name of the scripting object that corresponds to a window or control.

  • A Picture object reference.

Note: To post a screenshot of the entire desktop, set Sys.Desktop or Sys.Desktop.Picture() as the value of the Picture parameter.

MessageText

Text that will be posted to the log along with the image (same as the Message parameter on the Select Object page). This text will be added to the Message column of the test log.

AdditionalText

Additional text to be posted to the log along with the image (the same text that is specified on the Details parameter of the Select Object page). This text will be displayed in the Details pane of the test log.

Priority

Priority of the image message. You can use any integer number or any of the following constants:

Constant Value Description
pmLowest 100 The lowest priority of the message.
pmLower 200 The message priority which is lower than normal.
pmNormal 300 The normal (default) priority of the message.
pmHigher 400 The message priority which is higher than normal.
pmHighest 500 The highest priority of the message.

For information on specifying the Priority parameter value, see Specifying Enumeration Values in Parameters.

Attr

A LogAttributes object that contains the font and color attributes to be applied to the message in the test log.

You can create this object by using the Log Attributes operation or script code. In the latter case, to specify the parameter, you should use a script expression that returns a reference of the LogAttributes object or use a variable, test parameter or [Last Operation Result] value that contains the object reference.

If this parameter is omitted, default attributes will be applied.

FolderID

Identifier of the test log’s folder to which the image will be posted. This can be, for instance, the identifier of the folder created by the previous Append Log Folder operation, or the identifier returned by the Log.AppendFolder or Log.CreateFolder scripting method.

If this parameter refers to a non-existent folder, is omitted or is set to -1 (the default value), the operation will post the image to the currently active folder.

See Also

Logging Category
Specifying Operation Parameters
Checking Operation Result
Working With Images
Posting Images to the Log
Picture Method
Log Message Operation
Append Log Folder Operation
Log Attributes Operation
About Mobile Screen Window
Selecting an Object on the Mobile Screen (Android Testing)
Select an Object on the Mobile Screen (iOS Testing)
Preparing Android Applications
Preparing iOS Applications
Testing Mobile Applications

Highlight search results