GetUnderlyingObject Method

Applies to TestComplete 15.64, last modified on June 12, 2024


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.



Result Object

Applies To

To all mapped processes, windows and controls.

Result Value

A test object, to which NameMappingObj corresponds.


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








    C++Script, C#Script


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


See the example in the Remarks section above.

See Also

Name Mapping

Highlight search results