NameMapping Object

Applies to TestComplete 15.70, last modified on December 17, 2024

Description

The NameMapping object provides a program interface to the objects specified via their custom names that were assigned to them in the current TestComplete project. See Name Mapping. The child objects of NameMapping are the objects with custom names, that are also called name mapping items. They are organized in the same manner as the name mapping items in the Adding Objects to the Name Mapping Repository topic. To obtain an item from a script, you should use the following notation: NameMapping.MappedName, where MappedName is the custom name assigned to the object.

The NameMapping object is only available if your project contains the Name Mapping project item.

Members

Example

The following code snippet determines what version of Internet Explorer is installed on the current computer and, depending on the version, sets the name mapping configuration.

JavaScript, JScript

function NameMappingSample()
{
  // Specifies the installed version of Internet Explorer
  var ver = Options.IESettings.GetInternetExplorerMajorVersion();

  // Sets the name mapping configuration
  if (ver > 7)
    NameMapping.CurrentConfigurationName = "IE8";
  else
    NameMapping.CurrentConfigurationName = "IE6&7";

  // Performs testing actions
  …

}

Python

def NameMappingSample():
  # Specifies the installed version of Internet Explorer 
  ver = Options.IESettings.GetInternetExplorerMajorVersion()
  # Sets the name mapping configuration 
  if ver > 7:
    NameMapping.CurrentConfigurationName = "IE8"
  else:
    NameMapping.CurrentConfigurationName = "IE6&7"
    # Performs testing actions

VBScript

Sub NameMappingSample

  ' Specifies the installed version of Internet Explorer
  ver = Options.IESettings.GetInternetExplorerMajorVersion

  ' Sets the name mapping configuration
  If ver > 7 Then
    NameMapping.CurrentConfigurationName = "IE8"
  Else
    NameMapping.CurrentConfigurationName = "IE6&7"
  End If

  ' Performs testing actions
  …

End Sub

DelphiScript

procedure NameMappingSample();
var ver;
begin
  // Specifies the installed version of Internet Explorer
  ver := Options.IESettings.GetInternetExplorerMajorVersion;

  // Sets the name mapping configuration
  if (ver > 7) then
    NameMapping.CurrentConfigurationName := 'IE8'
  else
    NameMapping.CurrentConfigurationName := 'IE6&7';

  // Performs testing actions
  …

end;

C++Script, C#Script

function NameMappingSample()
{
  // Specifies the installed version of Internet Explorer
  var ver = Options.IESettings.GetInternetExplorerMajorVersion();

  // Sets the name mapping configuration
  if (ver > 7)
    NameMapping.CurrentConfigurationName = "IE8";
  else
    NameMapping.CurrentConfigurationName = "IE6&7";

  // Performs testing actions
  …

}

See Also

Name Mapping
Aliases Object

Highlight search results