Native UI Automation methods

Relevant for: GUI tests and components

UFT One UI Automation support provides for a number of native methods accessible with the .Object method. These methods are available for all UI Automation objects.

Each object is assumed to be a collection, even if it is a regular object. This enables UFT One and the .Object method to work with both a single object and a collection.

Note: When using the .Object method, UFT One returns the value "as-is", which can be complex and include several different flags.

See the MSDN reference for the value of these numerical properties. For example, for the State property, see here.

Method Description
Compare

Returns an element is equal to the selected object.

Syntax

.Object.Compare Element

Parameters

Element: The element to which to compare the selected element.

GetElementFromPoint

Returns an object at the selected coordinates.

Syntax

.Object.GetElementFromPoint x,y

Parameters

  • X: The x-coordinate at which to find the object.

  • Y: The y-coordinate at which to find the object.

Filter

Returns the objects of a collection that meet the requested expression.

Syntax

.Object.Filter("PropertyName1:=PropertyValue1", "..." , "PropertyNameX:=PropertyValueX")

Use static programmatic descriptions to specify an object.

For details on static programmatic descriptions, see Static programmatic descriptions.

Find

Returns the collection of objects with the requested expression.

This method searches objects to the end of object hierarchy, beginning from the object on which the method was called.

Syntax

.Object.Find("PropertyName1:=PropertyValue1", "..." , "PropertyNameX:=PropertyValueX")

Use static programmatic descriptions to specify an object.

For details on static programmatic descriptions, see Static programmatic descriptions.

Note: If this method is used from the Desktop object, it searches only the top level windows.

GetChildren

Returns a list of all children of the selected object.

Syntax

.Object.GetChildren

GetFirstChild

Returns the first child object of the selected object. If there are no child objects, UFT One returns a NULL value.

Syntax

.Object.GetFirstChild

GetFocusedElement

Returns the currently focused object.

Syntax

.Object.GetFocusedElement

GetLastChild

Returns the last child object of the selected object. If there are not child objects, UFT One returns a NULL value.

Syntax

.Object.GetChildren

GetNextSibling

Returns the element which is next in the overall hierarchy to the selected object.

Syntax

.Object.GetNextSibling

GetParent

Returns the parent element for a selected object.

Syntax

.Object.GetParent

GetPreviousSibling

Returns the element which is prior in the overall hierarchy to the selected object.

Syntax

.Object.GetPreviousSibling

GetRootElement

Returns the Desktop object (which is the root element of all objects in the hierarchy).

Syntax

.Object.GetRootElement

Has

Returns objects that have children with the requested expression.

This method searches children to the end of hierarchy.

Syntax

.Object.Has("PropertyName1:=PropertyValue1", "..." , "PropertyNameX:=PropertyValueX")

Use static programmatic descriptions to specify an object.

For details on static programmatic descriptions, see Static programmatic descriptions.

See also: