Work with Insight or Text test objects
Relevant for: GUI tests and components
Add Insight or Text test objects to the object repository directly from the application, or even from a picture of the object displayed on your screen.
Add an Insight or Text object
This section describes how to add an Insight or Text test object to the object repository.
To add an Insight or Text object
In the Object Repository Manager or Object Repository window, click the Add Insight Object to Local <![CDATA[ ]]> or Add Text Object to Local toolbar button.
In the Select Learn Mode dialog box, select the mode you want for learning the object, and then select the control or text.
Note: To display the Select Learn Mode dialog box, enable this option in the Options dialog box (Tools > Options > GUI Testing tab > Insight & Text Objects node).Automatic learn mode
The pointer changes to a pointing hand. Click on the control or text in the application.
UFT One automatically detects the borders of the control or text, and takes a snapshot of it.
This mode is the faster mode and should be satisfactory for Insight objects in most cases.Manual learn mode
The pointer changes to a crosshair, with an adjacent circle displaying a magnified image of the area around the center of the crosshair.
Take a snapshot of the control or text in the application, manually specifying the borders of the control or text.
Use this mode in cases where the automatic mode does not correctly detect the borders of the control or text, such as when it selects an area of the application which is much larger than the area you want.
By holding the left CTRL, you can temporarily change the pointing hand or crosshair to a standard pointer.
This enables you to change the window focus or perform operations in UFT One or in your application.
In the Add Insight Test Object or Add Text Test Object dialog box, you can:
Adjust the borders of the image saved with the test object in the object repository.
Take a new snapshot to replace the image entirely.
For Insight objects:
Specify areas to exclude from the test object image. UFT One will ignore these areas when it searches for the image on the screen to identify the object.
Modify the test object's ClickPoint. This is the location to click in the control when running a test object method on it.
Click Save to add the Insight or Text test object.
A new test object is added with the selected image to the object repository, under the test object that represents the application or window that contains the control or text.
In the object repository:
- An Insight object is named InsightObject, and the saved image is used to identify the control in the application.
For a Text object, UFT One uses OCR to extract the text from the image and save it in the text property of the object. The test object name is based on the extracted text, and the text is used to identify the relevant text in the application.
UFT One version 2022 and later: When using ABBYY OCR, UFT One uses additional color-related properties for text identification, including textcolor, backgroundcolor, huethreshold, and isinverted. These properties take effect only when Abbyy OCR is used.
Define a new Text test object
You can create a Text test object in the object repository by description, specifying the text to use to identify the object in the application.
Use the Define New Test Object button in the toolbar as described in Define a new test object.
In the Environment drop-down list, select IBA. Then select the TextObject class and specify the properties to use for object identification.
UFT One version 2022 and later: If you are using ABBYY OCR, you can specify color-related properties by clicking the Add description properties button.
Modify an Insight or Text test object's image
In the Object Repository or Object Repository Manager window, select the test object whose image you want to modify.
If you are in the Editor, double-click the test object's image in a step.
In the Test object image area, click the Change Test Object Image button.
If you modify the image of a Text object, the test object's text property is updated accordingly.
UFT One version 2022 and later: When using ABBYY OCR (on an object added using ABBYY OCR), the test object's color-related properties are updated as well.
Retrieve text from an Insight object
Use the Insight.GetVisibleText method to retrieve text displayed on an Insight object. UFT One uses the OCR mechanism to recognize and return the text.
Use this text for verification purposes, or as a way of differentiating between objects or states of the application.
If the text on a button in your application changes when an operation succeeds, check that text to verify success.
Make sure to use "exclude areas" to ignore the text area in the Insight object definition.
If you have two similar objects in your application, that are different only because of their text, learn them both as the same object, using "exclude areas" to ignore the text in the image.
Then, use GetVisibleText to check the text on the object and differentiate between the two objects in your test or component.
For more details, see the Insight section of the UFT One Object Model Reference for GUI Testing.
Update Insight test object details
Do any of the following to improve the readability and efficiency of your test or component:
Rename the test object to a name that describes the control it represents. (Recommended)
Move the test object within the test object hierarchy:
If you place it under another test object...
UFT One searches for the object in the application only within its parent test object.
If you move the Insight test object to be a top-level object... UFT One searches for the object anywhere on the screen.
Update additional description properties such as similarity, skipmakeobjvisible, methodoptionorder, and ratiotestthreshold of the test object description.
For details, see the InsightObject description properties topic in the UFT One Object Model Reference for GUI Testing.
Modify the ordinal identifier created for the test object. For details, see Ordinal identifiers.
Define visual relation identifiers for the test object. For details, see Visual relation identifiers.
For more details , see Maintain test objects in object repositories.
Tip: When you have finished modifying all of the Insight test objects, delete all of the snapshots to reduce the amount of disk space used. This does not delete the test object images used for object identification.
Select Tools > Delete Insight Snapshots.