WaitUIAObject Method

Applies to TestComplete 15.44, last modified on November 10, 2022

Description

Use this method to pause the script execution until the specified child object, whose methods and properties are exposed by the UI Automation Support plugin, becomes available or until the specified timeout interval is over. The resulting object contains both methods and properties exposed by the plugin as well as methods and properties provided by TestComplete.

Declaration

TestObj.WaitUIAObject(Name, Index, Timeout)

TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
Name [in]    Required    String    
Index [in]    Optional    String Default value:    
Timeout [in]    Required    Integer    
Result Object

Applies To

The method is applied to the following objects:

View Mode

To view this method in the Object Browser panel and in other panels and dialogs, activate the Advanced view mode.

Parameters

The method has the following parameters:

Name

The name of the desired object. To obtain the object’s name, use the ObjectIdentifier property.

Index

The index of the desired object. To obtain the object’s index, use the ObjectGroupIndex property.

Use this property only if the index is specified for the tested UIAObject object in the Object Browser.

Timeout

The number of milliseconds to wait until the specified object becomes available. If Timeout is 0, the method returns immediately. If Timeout is -1, the wait time is infinite.

Note that Timeout value is not strict and if the tested application is busy, TestComplete could wait for the object for a longer period of time than it is specified by the parameter. The following can cause this:

A call to any WaitXXXObject method causes the object tree to refresh. To update object data, TestComplete may call some of object’s native methods that are accessible only from the application’s thread. When the thread is busy, TestComplete tries to call those methods during some pre-defined time (one second) thus delaying the refresh. There could be several attempts to get the object’s data which could result in a noticeable difference from the Timeout value.

Result Value

The WaitUIAObject method returns an object that provides a scripting interface to a child object, whose methods and properties are exposed through the UI Automation Support plugin. If TestComplete cannot access the specified object (for example, this object does not exist), WaitUIAObject will return an empty stub object. To determine whether the method returns a valid object, use the Exists property of the resultant object. If this property returns False, then the returned object is a stub object and the call to WaitUIAObject was not successful.

Remarks

You can use the WaitUIAObject method to obtain child objects only if the UI Automation Support plugin contains a Name property that is exposed by the UI Automation Support plugin. If the plugin does not expose the Name property, use the WaitWindow method.

The returned object contains both methods and properties exposed by the UI Automation Support plugin and methods, properties and actions provided by TestComplete. The resulting object may hold two or more methods and properties having the same name. To avoid naming conflicts, TestComplete places the methods and properties exposed by the plugin to the NativeUIAObject namespace.

The WaitUIAObject method is available only if the UI Automation Support plugin is installed. Otherwise, the method is absent in the method list of the TestObj object.

See Also

Using Microsoft UI Automation Technology - Overview
Requirements
Using Namespaces
UIAObject Method
Window Method

Highlight search results