GetUnderlyingObject Method

Applies to TestComplete 14.71, last modified on April 22, 2021

Description

The GetUnderlyingObject method is added to any object that is mapped with the Name Mapping feature.

Use the GetUnderlyingObject method to obtain reference to the test object, to which the mapped object corresponds. You need to use this method when the test object contains a method or property, whose name coincides with the name of some child mapped item. See the Remarks section below.

Declaration

.GetUnderlyingObject()

Result Object

Applies To

To all mapped processes, windows and controls.

Result Value

A test object, to which NameMappingObj corresponds.

Remarks

After you map a test object, its methods, properties and child objects become accessible through the Alias or NameMapping item that corresponds to this test object.

It is possible that the Alias or NameMapping item has a child item, whose name coincides with a method or property name of the underlying test object:


The Name Mapping editor

The Code Editor

When the test engine meets this name in a test, it is unable to determine whether you wanted to call the method or property, or whether you wanted to obtain the child item, but specified parameters by mistake. Here is how you can resolve the issue:

  • To call the method or property, use the GetUnderlyingObject() method to obtain the underlying test object reference, and then call the needed method or property in a usual manner:

    JavaScript, JScript

    Aliases.MyForm.MyProductList.GetUnderlyingObject().Item(2);

    Python

    Aliases.MyForm.MyProductList.GetUnderlyingObject().Item[2]

    VBScript

    Aliases.MyForm.MyProductList.GetUnderlyingObject.Item(2)

    DelphiScript

    Aliases.MyForm.MyProductList.GetUnderlyingObject.Item(2);

    C++Script, C#Script

    Aliases["MyForm"]["MyProductList"]["GetUnderlyingObject"]()["Item"](2);

  • To obtain a child item, specify its name and do not use parameters.

Note: Due to specifics of implementation, the GetUnderlyingObject method is not visible in the Code Completion window which is called for alias objects.

Example

See the example in the Remarks section above.

See Also

Name Mapping

Highlight search results