Resolve Name Collisions

Applies to TestComplete 15.47, last modified on January 20, 2023

A mapped object can have a mapped child object with the same name as the object’s property or method. To avoid ambiguity, call the property or method using the GetUnderlyingObject method.

Consider this example:

Objects in Name Mapping

The MainForm object has both the child Picture object and the standard Picture method for taking screenshots. To call the object’s Picture method, use the following syntax:

JavaScript, JScript

var img = Aliases.MyApp.MainForm.GetUnderlyingObject().Picture(5, 5, 100, 100);

Python

img = Aliases.MyApp.MainForm.GetUnderlyingObject().Picture(5, 5, 100, 100)

VBScript

Set img = Aliases.MyApp.MainForm.GetUnderlyingObject.Picture(5, 5, 100, 100)

DelphiScript

var
  img;
begin
  img := Aliases.MyApp.MainForm.GetUnderlyingObject.Picture(5, 5, 100, 100);
end;

C++Script, C#Script

var img = Aliases["MyApp"]["MainForm"]["GetUnderlyingObject"]()["Picture"](5, 5, 100, 100);

The syntax without GetUnderlyingObject refers to the child Picture object:

JavaScript, JScript

Aliases.MyApp.MainForm.Picture.Click();

Python

Aliases.MyApp.MainForm.Picture.Click()

VBScript

Aliases.MyApp.MainForm.Picture.Click

DelphiScript

Aliases.MyApp.MainForm.Picture.Click;

C++Script, C#Script

Aliases["MyApp"]["MainForm"]["Picture"]["Click"]();

See Also

How To
Name Mapping

Highlight search results