TextObject Object

Description

An object identified using OCR (Optical Character Recognition).

IMPORTANT

Use descriptive programming to describe TextObject test objects. You cannot spy on them, record them, or add them to the object repository.

A TextObject cannot be a top-level test object. UFT One searches for the TextObject in the application within the parent object specified in its definition. Any object that supports the CaptureBitmap method can be the parent of a TextObject test object.

The OCR engine used for TextObject objects is determined by the Text Recognition options configured in UFT One (Tools > Options > GUI Testing tab > Text Recognition).

Tip: You can test HTML5 Canvas in UFT One by using TextObject objects.

Operations

The sections below list the built-in methods and properties that you can use as operations for the TextObject object.

Note: You can also view a list and descriptions of the TextObject description properties, for use in 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 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 HoverPlaces the pointer on the object.
Method LongClickPresses and holds the left mouse button for a specific number of seconds.
Method MouseDownPresses the mouse button.
Method MouseMoveMoves the mouse pointer to the object.
Method MouseUpReleases the mouse button.
Common Method Output Retrieves 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 text. 
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 text. 


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


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

This method brings the TextObject’s parent test object into focus before performing the click. If this hides your TextObject in the application, making it impossible for UFT One to find and click it, you can use the TextObject.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 text. 
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 text. 


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


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 TextObject.Click method, if bringing the TextObject ’s parent test object into focus before performing the click hides your TextObject 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 text.
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 text.
Default value = -9999
Button Optional. A predefined constant or number.
The mouse button used to double-click the object.
Default value = micLeftBtn

Return Type

None

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 text.
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 text.
Default value = -9999
Button Optional. A predefined constant or number.
The mouse button used to drag the object.
Default value = micLeftBtn

Return Type

None

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 text.
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 text.
Default value = -9999

Return Type

None

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

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 text.
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 text.
Default value = -9999

Return Type

None

Example

Back to top

 

MouseDown Method

Description

Presses the mouse button.

Syntax

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

Arguments

ParameterDescription
x Optional. An integer value.
The x-coordinate of the location to press. Note that the specified coordinates are relative to the upper left corner of the text. 
Default value = -9999
y Optional. An integer value.
The y-coordinate of the location to press. Note that the specified coordinates are relative to the upper left corner of the text. 


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 press. micNoCoordinate indicates the center of the text.


Default value = -9999
Button Optional. A predefined constant or number.
The mouse button to press.
Default value = micLeftBtn

Return Type

None

Example

 

MouseMove Method

Description

Moves the mouse pointer to the object.

Syntax

object.MouseMove [x], [y]

Arguments

ParameterDescription
x Optional. An integer value.
The x-coordinate of the location to place the mouse. Note that the specified coordinates are relative to the upper left corner of the text. 
Default value = -9999
y Optional. An integer value.
The y-coordinate of the location to place the mouse. Note that the specified coordinates are relative to the upper left corner of the text. 
Default value = -9999

Return Type

None

Example

 

MouseUp Method

Description

Releases the mouse button.

Syntax

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

Arguments

ParameterDescription
x Optional. An integer value.
The x-coordinate of the location to release the mouse button. Note that the specified coordinates are relative to the upper left corner of the text. 
Default value = -9999
y Optional. An integer value.
The y-coordinate of the location to the location to release the mouse button. Note that the specified coordinates are relative to the upper left corner of the text. 


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 release. micNoCoordinate indicates the center of the text.


Default value = -9999
Button Optional. A predefined constant or number.
The mouse button to release.
Default value = micLeftBtn

Return Type

None

Example

 

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

Return Type

None

IMPORTANT

A TextObject 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 TextObject.Type operation on such an object, the method has no affect.

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

Return Type

None

IMPORTANT

  • A TextObject 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 TextObject.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, use the Password Encoder utility (Start > All Programs > Micro Focus > Micro Focus UFT One > Tools > Password Encoder) or 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.

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