InsightObject Object
Description
An object identified using image-based recognition.
IMPORTANT
Insight test objects are always created as children of the test object that contains them. You can then move the InsightObject under a different parent object in the Object Repository. For example, you may want the parent object to be another Insight object instead of a Standard Windows object.
OpenText Functional Testing searches for the Insight object in the application within the parent object defined in the Object Repository.
Operations
The sections below list the built-in methods and properties that you can use as operations for the InsightObject object.
Note: You can also view a list and descriptions of the InsightObject description properties, for use in object repository descriptions, programmatic descriptions, checkpoint and output value steps, and as argument values for the GetTOProperty and GetROProperty methods.
Methods
CaptureBitmap | Saves a screen capture of the object as a .png or .bmp image, depending on the specified file extension. |
CheckProperty | Checks whether the specified object property achieves the specified value within the specified timeout. |
Click | Clicks the object. |
ClickSpecial | Clicks the object, without first bringing its parent into focus. |
DblClick | Double-clicks the object. |
Drag | Performs the 'drag' part of a drag and drop operation. |
Drop | Performs the 'drop' part of a drag and drop operation. |
GetAllROProperties | Returns the collection of properties and current values from the object in the application. |
GetROProperty | Returns the current value of the specified description property from the object in the application. |
GetTOProperties | Returns the collection of properties and values used to identify the object. |
GetTOProperty | Returns the value of the specified description property from the test object description. |
Highlight | Highlights the object in the application. |
GetVisibleText | Returns the text from the specified area. |
Hover | Places the pointer on the object. |
LongClick | Presses and holds the left mouse button for a specific number of seconds. |
Output | Retrieves the current value of an item and stores it in a specified location. |
RefreshObject | Instructs OpenText Functional Testing to re-identify the object in the application the next time a step refers to this object. |
SetTOProperty | Sets the value of the specified description property in the test object description. |
ToString | Returns a string that represents the current test object. |
Type | Types the specified string in the object. |
TypeSecure | Types the encrypted value in the object. |
WaitProperty | Waits until the specified object property achieves the specified value or exceeds the specified timeout before continuing to the next step. |
Properties
Exist | Checks whether the object currently exists in the open application. |
Click Method
Description
Clicks the object.
Syntax
object.Click [x], [y], [Button]
Arguments
Parameter | Description |
---|---|
x |
Optional. An integer value. The x-coordinate of the click. Note that the specified coordinates are relative to the upper left corner of the object. The default value is the ClickPoint defined for the selected Insight test object. Default value = -9999 |
y |
Optional. An integer value. The y-coordinate of the click. Note that the specified coordinates are relative to the upper left corner of the object. The default value is the ClickPoint defined for the selected Insight test object.
Default value = -9999 |
Button |
Optional. A predefined constant or number. The mouse button used to click the object. Default value = micLeftBtn |
Return Type
None
IMPORTANT
If the coordinates are not provided, the method is performed at the object's ClickPoint. You can view and modify a test object's ClickPoint in the Object Repository, using the Change Test Object Image dialog box. For details, see the OpenText Functional Testing User Guide.
This method brings the Insight object’s parent test object into focus before performing the click. If this hides your Insight object in the application, making it impossible for OpenText Functional Testing to find and click it, you can use the InsightObject.ClickSpecial method, which does not bring the parent test object into focus before clicking. (Note: The parent test object that is brought into focus is the lowest-level parent that supports the MakeVisible method.)
Example
'The following example uses the Click method to perform a middle-button click 'on the "Contact Us" control on the sample website, using specific x,y coordinates 'to define the click location. Browser("MySite").InsightObject("ContactUs").Click(10, 5, micMiddleBtn)
ClickSpecial Method
Description
Clicks the object, without first bringing its parent into focus.
Syntax
object.ClickSpecial [x], [y], [Button]
Arguments
Parameter | Description |
---|---|
x |
Optional. An integer value. The x-coordinate of the click. Note that the specified coordinates are relative to the upper left corner of the object. The default value is the ClickPoint defined for the selected Insight test object. Default value = -9999 |
y |
Optional. An integer value. The y-coordinate of the click. Note that the specified coordinates are relative to the upper left corner of the object. The default value is the ClickPoint defined for the selected Insight test object.
Default value = -9999 |
Button |
Optional. A predefined constant or number. The mouse button used to click the object. Default value = micLeftBtn |
Return Type
None
IMPORTANT
Use this method instead of the regular InsightObject.Click method, if bringing the Insight object’s parent test object into focus before performing the click hides your Insight object in the application.
Example
'The following example uses the Click method to select the DropDownMenu object
'and expand the drop-down menu. It then uses the ClickSpecial method to select
'the MenuItem object from the drop-down menu. The ClickSpecial method does not
'refresh the parent object, and the menu items remain visible.
Window(“Settings”).InsightObject(“DropDownMenu”).Click
Window(“Settings”).InsightObject(“MenuItem”).ClickSpecial
DblClick Method
Description
Double-clicks the object.
Syntax
object.DblClick [x], [y], [Button]
Arguments
Parameter | Description |
---|---|
x |
Optional. An integer value. The x-coordinate of the double-click. Note that the specified coordinates are relative to the upper left corner of the object. Default value = -9999 |
y |
Optional. An integer value. The y-coordinate of the double-click. Note that the specified coordinates are relative to the upper left corner of the object. Default value = -9999 |
Button |
Optional. A predefined constant or number. See the Constants table, below. The mouse button used to double-click the object. Default value = micLeftBtn |
Return Type
None
IMPORTANT
If the coordinates are not provided, the method is performed at the object's ClickPoint. You can view and modify a test object's ClickPoint in the Object Repository, using the Change Test Object Image dialog box. For details, see the OpenText Functional Testing User Guide.
Example
'The following example uses the DblClick method to perform a left-button double- 'click on the "Contact Us" control on a sample website, using specific x,y 'coordinates to define the click location. Browser("MySite").InsightObject("ContactUs").DblClick(40, 2, micLeftBtn)
Drag Method
Description
Performs the 'drag' part of a drag and drop operation.
Syntax
object.Drag [x], [y], [Button]
Arguments
Parameter | Description |
---|---|
x |
Optional. An integer value. The x-coordinate within the window from which the object is dragged. Note that the specified coordinates are relative to the upper left corner of the object. The default value is the ClickPoint defined for the selected Insight test object. Default value = -9999 |
y |
Optional. An integer value. The y-coordinate within the window from which the object is dragged. Note that the specified coordinates are relative to the upper left corner of the object. The default value is the ClickPoint defined for the selected Insight test object. Default value = -9999 |
Button |
Optional. A predefined constant or number. See the Constants table, below. The mouse button used to drag the object. Default value = micLeftBtn |
Return Type
None
IMPORTANT
If the coordinates are not provided, the method is performed at the object's ClickPoint. You can view and modify a test object's ClickPoint in the Object Repository, using the Change Test Object Image dialog box. For details, see the OpenText Functional Testing User Guide.
Example
'The following example uses the Drag method to drag the "Contact Us" 'control from the center of the control, and then uses the Drop method 'to drop it on the center of the "Communities" control. Browser("MySite").InsightObject("ContactUs").Drag() Browser("MySite").InsightObject("Communities").Drop() 'The following example uses the Drag method to drag the "Communities" 'control on a sample website from coordinates (10,5), and then uses 'the Drop method to drop it at coordinates (100,-20). Browser("MySite").InsightObject("Communities").Drag(10, 5) Browser("MySite").InsightObject("Communities").Drop(100, -20)
Drop Method
Description
Performs the 'drop' part of a drag and drop operation.
Syntax
object.Drop [x], [y]
Arguments
Parameter | Description |
---|---|
x |
Optional. An integer value. The x-coordinate of the object onto which the object is dropped. Note that the specified coordinates are relative to the upper left corner of the object. The default value is the ClickPoint defined for the selected Insight test object. Default value = -9999 |
y |
Optional. An integer value. The y-coordinate of the object onto which the object is dropped. Note that the specified coordinates are relative to the upper left corner of the object. The default value is the ClickPoint defined for the selected Insight test object. Default value = -9999 |
Return Type
None
IMPORTANT
If the coordinates are not provided, the method is performed at the object's ClickPoint. You can view and modify a test object's ClickPoint in the Object Repository, using the Change Test Object Image dialog box. For details, see the OpenText Functional Testing Help Center.
Example
'The following example uses the Drag method to drag the "Contact Us" 'control from the center of the control, and then uses the Drop method 'to drop it on the center of the "Communities" control. Browser("MySite").InsightObject("ContactUs").Drag() Browser("MySite").InsightObject("Communities").Drop() 'The following example uses the Drag method to drag the "Communities" 'control on a sample website from coordinates (10,5), and then uses 'the Drop method to drop it at coordinates (100,-20). Browser("MySite").InsightObject("Communities").Drag(10, 5) Browser("MySite").InsightObject("Communities").Drop(100, -20)
GetVisibleText Method
Description
Returns the text from the specified area.
Syntax
object.GetVisibleText ([left], [top], [right], [bottom], [Language])
Arguments
Parameter | Description |
---|---|
left |
Optional. An integer value. The left coordinate of the search area, relative to the top-left corner of the test object image. Default: 0 (the left edge of the object) |
top |
Optional. An integer value. The top coordinate of the search area, relative to the top-left corner of the test object image. Default: 0 (the top edge of the object) |
right |
Optional. An integer value. The right coordinate of the search area.
|
bottom |
Optional. An integer value. The bottom coordinate of the search area
|
Language |
Optional. A String value. The language dictionary that the OCR mechanism should use to identify the text. |
Return Type
A String value.
IMPORTANT
- OpenText Functional Testing captures the text using an OCR (optical character recognition) mechanism.
- The text to capture must be visible in the application window when the step runs.
- The area is defined by pairs of coordinates that designate two diagonally opposite corners of a rectangle.
- If the Left, Top, Right, and Bottom arguments are not specified, the method returns all of the text within the visible part of the specified object.
- The results of this method may be different depending on the settings selected in the Text Recognition pane of the Options dialog box (Tools menu > Options item > GUI Testing tab > Text Recognition pane).
- You can use the Text Area Helper and the mouse coordinates displayed on the Change Test Object Image dialog box to help determine the coordinates to use for this method. For more details, see the OpenText Functional Testing User Guide.
Example
'The following example uses the GetVisibleText method to retrieve 'the text from an error message that was displayed in the application 'and determine which of the possible errors occurred. Dim errorMessage errorMessage = Browser("Browser").InsightObject("PopUp").GetVisibleText(5, 35, 30, 155, "English") Dim errorCode If errorMessage = "File Not Found" Then errorCode = 2 ElseIf errorMessage = "File Corrupted" Then errorCode = 3 End If
Hover Method
Description
Places the pointer on the object.
Syntax
object.Hover [x], [y]
Arguments
Parameter | Description |
---|---|
x |
Optional. An integer value. The x-coordinate of the object that the pointer is placed over. Note that the specified coordinates are relative to the upper left corner of the object. The default value is the ClickPoint defined for the selected Insight test object. Default value = -9999 |
y |
Optional. An integer value. The y-coordinate of the object that the pointer is placed over. Note that the specified coordinates are relative to the upper left corner of the object. The default value is the ClickPoint defined for the selected Insight test object. Default value = -9999 |
Return Type
None
IMPORTANT
- The pointer remains placed over the object for the amount of time defined in the Windows hover settings.
- If the coordinates are not provided, the method is performed at the object's ClickPoint. You can view and modify a test object's ClickPoint in the Object Repository, using the Change Test Object Image dialog box. For details, see the OpenText Functional Testing User Guide.
Example
'The following example uses the Hover method to expand the "Connect" menu on 'a sample website, using specific x,y coordinates to define the object. Browser("MySite").InsightObject("Connect").Hover(13, 6)
LongClick Method
Description
Presses and holds the left mouse button for a specific number of seconds.
Syntax
object.LongClick [Duration], [x], [y]
Arguments
Parameter | Description |
---|---|
Duration |
Optional. A double floating value. The number of seconds to hold the left mouse button when long-clicking. Default value = 1.10000002384186 |
x |
Optional. An integer value. The x-coordinate of the object to be long-clicked. Note that the specified coordinates are relative to the upper left corner of the object. The default value is the ClickPoint defined for the selected Insight test object. Default value = -9999 |
y |
Optional. An integer value. The y-coordinate of the object to be long-clicked. Note that the specified coordinates are relative to the upper left corner of the object. The default value is the ClickPoint defined for the selected Insight test object. Default value = -9999 |
Return Type
None
IMPORTANT
If the coordinates are not provided, the method is performed at the object's ClickPoint. You can view and modify a test object's ClickPoint in the Object Repository, using the Change Test Object Image dialog box. For details, see the OpenText Functional Testing User Guide.
Example
'The following example uses the LongClick method to add the Calculator 'application icon to the main screen in a touch-enabled environment, 'using specific x,y coordinates to define the object. Window("Android Emulator").InsightObject("Calculator").LongClick(1.5, 10, 15)
Type Method
Description
Types the specified string in the object.
Syntax
object.Type Text, [ClickBeforeType]
Arguments
Parameter | Description |
---|---|
Text |
Required. A String value. The text string to type in the object. |
ClickBeforeType |
Optional. A Boolean value. Specifies whether to click the object to bring it into focus before beginning the type operation. Possible values: Tip: If you want to click a different location in the object before typing, add a step that calls the Click method before the step that calls the Type method. Specify the click coordinates in the Click step, and in the Type step, set the ClickBeforeType parameter to False. Default value = True |
Return Type
None
IMPORTANT
- An Insight test object might represent an object in your application on which a type operation is irrelevant, such as a button or a menu. If you run an InsightObject.Type operation on such an object, the method has no affect.
- During Insight recording, when you type in the application, OpenText Functional Testing records the Type method on the relevant WinObject, and not on the Insight test object. After recording, you can delete this step, and replace it with a Type step performed on the relevant Insight test object.
By default, the InsightObject.Type method clicks the object before typing. Therefore, you can delete any Click steps that were recorded before Type steps.
For example, if the following were recorded:
Insight("ObjectName").Click
Window("WindowName").WinObject("Text").Type "SomeString"
you could change it to:
Insight("ObjectName").Type "SomeString"
Example
'The following example uses the Type method to first click the "Contact 'Us" control on a sample website, and then type "Hi there" in the control. Browser("MySite").InsightObject("ContactUs").Type("Hi there") 'The following example uses the Type method to type "Hello" in the '"Contact Us" control on a sample website, without clicking the 'control before typing. Browser("MySite").InsightObject("Communities").Type("Hello", False)
TypeSecure Method
Description
Types the encrypted value in the object.
Syntax
object.TypeSecure Text, [ClickBeforeType]
Arguments
Parameter | Description |
---|---|
Text |
Required. A String value. The encrypted text to type in the object. |
ClickBeforeType |
Optional. A Boolean value. Specifies whether to click the object to bring it into focus before beginning the type operation. Possible values: Tip: If you want to click a different location in the object before typing, add a step that calls the Click method before the step that calls the TypeSecure method. Specify the click coordinates in the Click step, and in the TypeSecure step, set the ClickBeforeType parameter to False. Default value = True |
Return Type
None
IMPORTANT
An Insight test object might represent an object in your application on which a type operation is irrelevant, such as a button or a menu. If you run an InsightObject.TypeSecure operation on such an object, the method has no affect.
To find the encrypted value to use as the argument for the TypeSecure method, do one of the following:
Use the Password Encoder utility (available from the Windows Start menu).
Parameterize the argument and use the Data Table encryption option (right-click each unencrypted value in the password column and choose Data > Encrypt).
For more information, see the OpenText Functional Testing Help Center.
While the TypeSecure method enables you to hide passwords on the screen when running a test, it is not intended to be a secure way to protect password information.
Example
'The following example uses the TypeSecure method type a user name in the ' "Username" field and an encrypted password in the "Password" field ' on a sample website. ' Each field is clicked before the typing operation is performed. Browser("MySite").InsightObject("Username").Type("My Name") Browser("MySite").InsightObject("Password").TypeSecure("424fe79992c06f8f77dd04e9cc8c73194a60")