AIObject Object

UFT One AI-based testing support:

UFT One version Mobile apps Desktop web
15.0 Supported Not supported
15.0.1 Supported Technical preview
15.0.2 Supported Supported

DescriptionUFT One version support:

An internal object used to perform operations on an object recognized using AI.

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 AIObject object, use the AIUtil.AIObject default property.

Operations

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

Methods

Method CheckExists

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

Supported in UFT One versions 15.0.2 and later.

Method CheckState

A checkpoint that checks the state of the object.

Supported in UFT One versions 15.0.2 and later.

Method Click Clicks the object.
Method Highlight

Highlights the object in the application.

Method Hover

Holds the cursor over the object.

Supported in UFT One versions 15.0.1 and later.

Method Search

Performs a search operation using an AIObject of type “Search”.

Method Select

Selects an item from a combo box.

Supported in UFT One versions 15.0.1 and later.

Method SetState Sets the state of a check box or toggle button to On or Off.
Method Type Types the specified string in the object.
Method TypeSecure Types the specified encrypted string in the object.

Back to top

Properties

Common Property Exist Checks 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.AIObject(ControlType, [text], [locator], [locatorData]).CheckExists expected

Or

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

Note: You can omit the AIObject property in the syntax, because AIObject is the default property for the AIUtil object.

Arguments

Parameter Description
expected

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

Possible values: 

true. The checkpoint passes if the object is founds 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

 

CheckState Method

Description

A checkpoint that checks the state of the object.

Supported in UFT One versions 15.0.2 and later.

Syntax

AIUtil.AIObject(ControlType, [text], [locator], [locatorData]).CheckState expectedState

Or

AIUtil(ControlType, [text], [locator], [locatorData]).CheckState expectedState

Note: You can omit the AIObject property in the syntax, because AIObject is the default property for the AIUtil object.

Arguments

Parameter Description
expectedState

A String value. Specifies the expected state of an object such as check box, radio button, or toggle.

Possible values: 

On. The checkpoint passes if the object's state is ON.

Off. The checkpoint passes if the object's state is OFF.

Note: The state check is case insensitive.

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

Syntax

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

or

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

Note: You can omit the AIObject property in the syntax, because AIObject is the default property for the AIUtil object.

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 object in the application.

Syntax

AIUtil.AIObject(ControlType, [text], [locator], [locatorData]).Highlight

or

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

Note: You can omit the AIObject property in the syntax, because AIObject is the default property for the AIUtil object.

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

Syntax

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

or

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

Note: You can omit the AIObject property in the syntax, because AIObject is the default property for the AIUtil object.

Arguments

Parameter Description
duration Optional. A Variant.

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

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

Search Method

Description

Performs a search operation using an AIObject of type “Search”.

Syntax

AIUtil.AIObject("Search").Search  [text]

or

AIUtil("Search").Search [text]

Note: You can omit the AIObject property in the syntax, because AIObject is the default property for the AIUtil object.

Arguments

Parameter Description
text Required. A String value.
The string to enter in the search box.

Return Type

None

IMPORTANT

The Search method is supported only for AIObjects of type "Search". The method enters the specified string in the search box and presses Enter.

Example

Back to top

Select Method

Supported in UFT One versions 15.0.1 and later.

Description

Selects an item from a combo box.

Syntax

AIUtil.AIObject(ControlType, [text], [locator], [locatorData]).Select  Item

or

AIUtil(ControlType, [text], [locator], [locatorData]).Select Item

Note: You can omit the AIObject property in the syntax, because AIObject is the default property for the AIUtil object.

Arguments

Parameter Description
Item

Required. A String value.
The item to select.

Return Type

None.

IMPORTANT

This method is supported for ControlType combo box, only in cases where UFT One can also identify this combo box as a WebList or a MobileDropDown.

Example

Back to top

SetState Method

Description

Sets the state of a check box or toggle button to On or Off.

Syntax

AIUtil.AIObject(ControlType, [text], [locator], [locatorData]).SetState  State

or

AIUtil(ControlType, [text], [locator], [locatorData]).SetState State

Note: You can omit the AIObject property in the syntax, because AIObject is the default property for the AIUtil object.

Arguments

Parameter Description
State

Required. A String value.
The state to set.

Possible values: On, Off (case-insensitive)

Return Type

None.

IMPORTANT

This method is supported for ControlType Toggle, Check box, and Radio button.

A radio button object represents one button in a radio group. Therefore, SetState on a radio button can only set the button to On. To set a radio button to Off, you must use SetState to set a different radio button in the group to On.

Example

Back to top

 

Type Method

Description

Types the specified string in the object.

Syntax

AIUtil.AIObject(ControlType, [text], [locator], [locatorData]).Type  [text]

or

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

Note: You can omit the AIObject property in the syntax, because AIObject is the default property for the AIUtil object.

Arguments

Parameter Description
text Required. A String value.
The string to type.

Return Type

None

Example

Back to top

 

TypeSecure Method

Description

Types the specified encrypted string in the object.

Syntax

AIUtil.AIObject(ControlType, [text], [locator], [locatorData]).TypeSecure  [text]

or

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

Note: You can omit the AIObject property in the syntax, because AIObject is the default property for the AIUtil object.

Arguments

Parameter Description
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.AIObject(ControlType, [text], [locator], [locatorData]).Exist([TimeOut])

or

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

Note: You can omit the AIObject property in the syntax, because AIObject is the default property for the AIUtil object.

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

Return Type

A Boolean value indicating whether the object exists.

Example

Back to top