AITextObject Object

Note: In UFT 15.0, AI-based testing is supported for mobile testing only.

In UFT 15.0.1, desktop web support is added as a technical preview.

Description

An internal object used to perform operations on text identified by AI in the application.

AI objects are supported in UFT only when the UFT Web Add-in or Mobile Add-in are installed and loaded.

IMPORTANT

To retrieve an AITextObject object, use the AIUtil.FindText or AIUtil.FindTextBlock property.

Operations

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

Method Click Clicks the text.
Method Highlight Highlights the text in the application.
Method Hover

Holds the cursor over the text.

Supported in UFT versions 15.0.1 and later.

Method Exist Checks whether the object currently exists in the context.

 

Click Method

Description

Clicks the text.

Syntax

AIUtil.FindText(text).Click [x], [y]

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 middle of the object (-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 middle of the object (-9999).

Return Type

None

Example

Back to top

 

Highlight Method

Description

Highlights the text in the application.

Syntax

AIUtil.FindText(text).Highlight

Return Type

None

Example

Back to top

Hover Method

Supported in UFT versions 15.0.1 and later.

Description

Holds the cursor over the text.

Syntax

AIUtil.FindText(text).Hover [duration]

Arguments

Parameter Description
duration Optional. A Variant.

The time period (in seconds) to hold the cursor over the text.

You can specify partial seconds as a duration time.

Default: 2 seconds.

Return Type

None

IMPORTANT

This method is supported only on Web applications running in a Web browser on a Desktop computer and not on mobile devices.

Before a Hover step, use the AIUtil.IsMobileContext to make sure the current AI context is a desktop web browser.

Designing your test this way makes it easier to use the same test for your web application on various platforms.

Example

Back to top

 

Exist Method

Description

Checks whether the object currently exists in the set context.

Syntax

AIUtil.FindText(text).Exist ([TimeOut])

Arguments

Parameter Description
TimeOut

Optional. An unsigned long integer value.

The length of time (in seconds) to search for the object before returning a True or False value.

  • If a timeout value is specified, UFT waits until it finds the object or until the timeout is reached.

  • If no value is specified, the value specified in the Test Settings dialog box for the Object Synchronization Timeout is used for tests. For business components, the pre-defined value of 20 seconds is used.

Note: A value of 0 is not supported for Mobile test objects.

For more information on the Object Synchronization Timeout, see the Unified Functional Testing User Guide.

Return Type

A Boolean value

Example

Back to top