Control Snapshots
Control snapshots is an essential feature in automation testing, used to capture and save images of controls. During control detection, snapshots can be automatically saved according to user settings. These snapshots help users review the control's appearance or serve as a reference for image-based comparisons.
You can configure whether snapshots are automatically captured via Auto-Screenshot Settings.
Uses of Snapshots
In control detection and operations, snapshots are mainly used in the following scenarios:
- Pattern Controls: For pattern controls, snapshots participate directly in control recognition.
- Standard Controls: For standard controls, snapshots serve as a visual reference and do not affect recognition. They can also be used for image comparison checks or for creating virtual controls.
Main applications include:
- Image Checkpoints: Compare the current appearance of a control with the expected result. See Image Checkpoints for details.
- Creating Pattern or Virtual Controls: Snapshots allow creation of sub-pattern controls or virtual controls, enabling operations on specific sub-regions of a control.
Managing Snapshots
When adding a new control to the model, a snapshot is automatically captured. Only leaf-node controls are saved; the entire model tree is not captured. Snapshots are stored in the *_files folder corresponding to the *.tmodel file.
You can configure whether snapshots are automatically captured. See Auto-Screenshot Settings for details.
On the Control Snapshots Management page, you can manage cached snapshots in the model, including deleting, updating, or creating sub-control objects based on snapshots:
- Delete Snapshot
: Removes the snapshot of a control and deletes the corresponding image file from the project's
*_filesfolder. - Update Snapshot
: Captures a new snapshot for the control and overwrites the original image. This is equivalent to the toolbar Screenshot button.
Operations Based on Control Snapshots
Control snapshots can be used for advanced operations beyond simple visual inspection:
Create Sub-Pattern Control
Click to select a region within the snapshot and generate a sub-pattern control. See Create Sub-Pattern Control for detailed steps.
Create Virtual Control
Click to select an area within the snapshot and quickly create a virtual control. Virtual controls record coordinates and dimensions relative to the parent control and are suitable for complex control hierarchies. After creation, you can fine-tune the virtual control's parameters. See Advanced Editing of Virtual Controls.
Advanced Virtual Control Editing
Click to open the virtual control editor, allowing adjustments such as position and size. This feature is equivalent to the Edit Virtual Control option in the right-click menu.
OCR Text Recognition
Click to use OCR to recognize text within the snapshot and return the result. OCR works similarly to the virtual control's visualText method and can be used for text comparison or operations.