AITextObject Object

UFT One AI-based testing support:

UFT One versionMobile appsDesktop web
15.0SupportedNot supported
15.0.1Supported Technical preview
15.0.2SupportedSupported

Description

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

IMPORTANT

AI objects are supported in UFT One only when:

  • The UFT One Web Add-in or Mobile Add-in are installed and loaded.
  • The UFT One AI Features are installed and AI is enabled in the UFT One options. For details, see the UFT One Help Center.

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

Operations

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

Methods

Method CheckExists **

A checkpoint that checks whether the object currently exists in the set context.

Method ClickClicks the text.
Method GetText **

Retrieves the object’s text.

Method HighlightHighlights the text in the application.
Method Hover *

Holds the cursor over the text.

Method Type **

Types the specified string in an input or edit box identified as text.

Method TypeSecure **

Types the specified encrypted string in an input or edit box identified as text.

* Supported in UFT One versions 15.0.1 and later.

** Supported in UFT One versions 15.0.2 and later.

Properties

Common Property ExistChecks whether the object currently exists in the set context.

 

CheckExists Method

Supported in UFT One versions 15.0.2 and later.

Description

A checkpoint that checks whether the object currently exists in the set context.

Syntax

AIUtil.FindText(text, [locator], [locatorData]).CheckExists expected

Arguments

ParameterDescription
expected

A Boolean value. Specifies whether this checkpoint expects the object to exist.

Possible values: 

true. The checkpoint passes if the object is found within the set context before the timeout expires.

false. The checkpoint passes if the object is not found by the time the timeout expires.

Remarks

This method uses the timeout defined in the Object Synchronization Timeout option in the Run pane of the Test Settings dialog box.

Return Type

A Boolean value.

Returns TRUE if the checkpoint passes, otherwise FALSE.

A TRUE return value reports a Passed step to the run results; a FALSE return value reports a Failed step to the run results.

Example

Back to top

 

Click Method

Description

Clicks the text.

Syntax

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

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

 

GetText Method

Supported in UFT One versions 15.0.2 and later.

Description

Retrieves the object’s text.

Syntax

AIUtil.FindText(text, [locator], [locatorData]).GetText

Return Type

String

Example

Back to top

 

Highlight Method

Description

Highlights the text in the application.

Syntax

AIUtil.FindText(text, [locator], [locatorData]).Highlight

Return Type

None

Example

Back to top

Hover Method

Supported in UFT One versions 15.0.1 and later.

Description

Holds the cursor over the text.

Syntax

AIUtil.FindText(text, [locator], [locatorData]).Hover [duration]

Arguments

ParameterDescription
duration Optional. An Integer value.

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

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

 

Type Method

Supported in UFT One versions 15.0.2 and later.

Description

Types the specified string in an input or edit box identified as text.

Syntax

AIUtil.FindText(text, [locator], [locatorData]).Type  [text]

Arguments

ParameterDescription
text Required. A String value.
The string to type.

Return Type

None

Example

Back to top

 

TypeSecure Method

Supported in UFT One versions 15.0.2 and later.

Description

Types the specified encrypted string in an input or edit box identified as text.

Syntax

AIUtil.FindText(text, [locator], [locatorData]).TypeSecure  [text]

Arguments

ParameterDescription
text Required. A String value.
The encrypted string to type.

Return Type

None

IMPORTANT

To find the encrypted value to use as the argument for the TypeSecure method, use the Password Encoder utility (Start > All Programs > Unified Functional Testing > 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 Unified Functional Testing Help.

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

 

Exist Property

Description

Checks whether the object currently exists in the set context.

Syntax

AIUtil.FindText(text, [locator], [locatorData]).Exist([TimeOut])

Arguments

ParameterDescription
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 One 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 UFT One Help Center.

Remarks

UFT One versions 15.0.2 and later: The Exist property can only be used in statements that use its return value. For example, assignment, print, and if statements.

Return Type

A Boolean value

Example

Back to top