InsightObject Object

Description

An object identified using image-based recognition.

IMPORTANT

Insight test objects are always created as children of the UFT One 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.

UFT One 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

Common Method CaptureBitmapSaves a screen capture of the object as a .png or .bmp image, depending on the specified file extension.
Common Method CheckPropertyChecks whether the specified object property achieves the specified value within the specified timeout.
Method ClickClicks the object.
Method ClickSpecialClicks the object, without first bringing its parent into focus.
Method DblClickDouble-clicks the object.
Method DragPerforms the 'drag' part of a drag and drop operation.
Method DropPerforms the 'drop' part of a drag and drop operation.
Common Method GetAllROProperties

Returns the collection of properties and current values from the object in the application.

Common Method GetROPropertyReturns the current value of the specified description property from the object in the application.
Common Method GetTOPropertiesReturns the collection of properties and values used to identify the object.
Common Method GetTOPropertyReturns the value of the specified description property from the test object description.
Common Method HighlightHighlights the object in the application.
Method GetVisibleTextReturns the text from the specified area.
Method HoverPlaces the pointer on the object.
Method LongClickPresses and holds the left mouse button for a specific number of seconds.
Common Method OutputRetrieves the current value of an item and stores it in a specified location.
Common Method RefreshObjectInstructs UFT One to re-identify the object in the application the next time a step refers to this object.
Common Method SetTOPropertySets the value of the specified description property in the test object description.
Common Method ToStringReturns a string that represents the current test object.
Method TypeTypes the specified string in the object.
Method TypeSecureTypes the encrypted value in the object.
Common Method WaitPropertyWaits until the specified object property achieves the specified value or exceeds the specified timeout before continuing to the next step.

Properties

Common Property ExistChecks whether the object currently exists in the open application.

Back to top

 

Click Method

Description

Clicks the object.

Syntax

object.Click [x], [y], [Button]

Arguments

ParameterDescription
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.


Tip: You can enter micNoCoordinate (-9999) for the x and y argument values if you want to enter a value for the button argument without specifying x- and y- coordinates for the click. micNoCoordinate indicates the center of the 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 UFT One 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 UFT One 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

Back to top

 

ClickSpecial Method

Description

Clicks the object, without first bringing its parent into focus.

Syntax

object.ClickSpecial [x], [y], [Button]

Arguments

ParameterDescription
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.


Tip: You can enter micNoCoordinate (-9999) for the x and y argument values if you want to enter a value for the button argument without specifying x- and y- coordinates for the click. micNoCoordinate indicates the center of the 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

Back to top

 

DblClick Method

Description

Double-clicks the object.

Syntax

object.DblClick [x], [y], [Button]

Arguments

ParameterDescription
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 UFT One User Guide.

Example

Back to top

 

Drag Method

Description

Performs the 'drag' part of a drag and drop operation.

Syntax

object.Drag [x], [y], [Button]

Arguments

ParameterDescription
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 UFT One User Guide.

Example

Back to top

 

Drop Method

Description

Performs the 'drop' part of a drag and drop operation.

Syntax

object.Drop [x], [y]

Arguments

ParameterDescription
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 UFT One User Guide.

Example

Back to top

 

GetVisibleText Method

Description

Returns the text from the specified area.

Syntax

object.GetVisibleText ([left], [top], [right], [bottom], [Language])

Arguments

ParameterDescription
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.

  • Values smaller than 0 are relative to the bottom-right corner of the test object image.
  • Values greater than 0 are relative to the top-left corner of the test object image.
  • Default: 0 (the right edge of the object
bottom Optional. An integer value.

The bottom coordinate of the search area

  • Values smaller than 0 are relative to the bottom-right corner of the test object image.
  • Values greater than 0 are relative to the top-left corner of the test object image.
  • Default: 0 (the bottom edge of the object)
Language Optional. A String value.

The language dictionary that the OCR mechanism should use to identify the text.
For available languages, see Tools > Options > GUI Testing > Text Recognition.
Default: English

Return Type

A String value.

IMPORTANT

  • UFT One 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 UFT One User Guide.

Example

Back to top

 

Hover Method

Description

Places the pointer on the object.

Syntax

object.Hover [x], [y]

Arguments

ParameterDescription
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 UFT One User Guide.

Example

Back to top

 

LongClick Method

Description

Presses and holds the left mouse button for a specific number of seconds.

Syntax

object.LongClick [Duration], [x], [y]

Arguments

ParameterDescription
Duration Optional. A double floating value.

The number of seconds to hold the left mouse button when long-clicking.
Default duration = 1.1 seconds


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 UFT One User Guide.

Example

Back to top

 

Type Method

Description

Types the specified string in the object.

Syntax

object.Type Text, [ClickBeforeType]

Arguments

ParameterDescription
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:
True (default) - The object's ClickPoint is clicked before typing.
False - The Type operation is performed at the current location of the cursor.

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, UFT One 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

Back to top

 

TypeSecure Method

Description

Types the encrypted value in the object.

Syntax

object.TypeSecure Text, [ClickBeforeType]

Arguments

ParameterDescription
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:
True (default) - The object's ClickPoint is clicked before typing.
False - The TypeSecure operation is performed at the current location of the cursor.

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 UFT One 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

Back to top