Object Model Reference for GUI Testing > Insight > Click Method

InsightObject Object

Description

An object identified using image-based recognition.

IMPORTANT

Insight test objects are always created as children of the UFT 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 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 CaptureBitmap Saves a screen capture of the object as a .png or .bmp image, depending on the specified file extension.
Common Method CheckProperty Checks whether the specified object property achieves the specified value within the specified timeout.
Method Click Clicks the object.
Method ClickSpecial Clicks the object, without first bringing its parent into focus.
Method DblClick Double-clicks the object.
Method Drag Performs the 'drag' part of a drag and drop operation.
Method Drop Performs the 'drop' part of a drag and drop operation.
Common Method GetROProperty Returns the current value of the specified description properties from the object in the application.
Common Method GetTOProperties Returns the collection of properties and values used to identify the object.
Common Method GetTOProperty Returns the value of the specified description properties from the test object description.
Method GetVisibleText Returns the text from the specified area.
Method Hover Places the pointer on the object.
Method LongClick Presses and holds the left mouse button for a specific number of seconds.
Common Method Output Retrieves the current value of an item and stores it in a specified location.
Common Method RefreshObject Instructs UFT to re-identify the object in the application the next time a step refers to this object.
Common Method SetTOProperty Sets the value of the specified description properties in the test object description.
Common Method ToString Returns a string that represents the current test object.
Method Type Types the specified string in the object.
Common Method WaitProperty Waits until the specified object property achieves the specified value or exceeds the specified timeout before continuing to the next step.

Properties

Common Property Exist Checks 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

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.


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

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.


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

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 Unified Functional Testing 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

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 Unified Functional Testing 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

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 Unified Functional Testing 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

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.

  • 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

Example


 

Back to top

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

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

Parameter Description
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 Unified Functional Testing User Guide.

Example


 

Back to top

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:
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

   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