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:
-
Pick the object using the target glyph
Drag the target glyph () to the desired window or control.
To select an object in a mobile application, drag the target glyph to the desired object on the Mobile Screen (see Select an Object on the Mobile Screen).
Select an Object on the Mobile Screen (for Android Applications)
Select an Object on the Mobile Screen (for iOS Applications)
While dragging, a red frame indicates the object that is currently under the mouse pointer. Once the frame appears around the desired object, drop the glyph.
-
Point to the object and fix
Click the button and move the mouse pointer to the desired window or control.
To select an object in a mobile application, move the mouse pointer over the desired object on the Mobile Screen (see Select an Object on the Mobile Screen).
Select an Object on the Mobile Screen (for Android Applications)
Select an Object on the Mobile Screen (for iOS Applications)
While moving, a red frame indicates the object that is currently under the mouse pointer. When the frame appears around the desired object, press the Select object shortcut, Shift+Ctrl+A (this shortcut can be changed in the Global Shortcuts dialog).
-
Select arbitrary object area
Click the button and use the crosshairs pointer to draw the rectangle indicating the object area that you want to capture.
-
Enter object name manually
Enter the full name, full mapped name or alias of the desired object into the Object box and press Enter.
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, 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 Additional Information
On this page, you can specify the image description:
Message
Additional Information
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 Additional Information parameter of the Select Object page). This text will be displayed in the Additional Info 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
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)
Instrumenting Android Applications - Overview
Preparing iOS Applications
Testing Mobile Applications