ParamName Property

Applies to TestComplete 15.69, last modified on November 13, 2024

Description

The ParamName property returns the name of the method parameter specified by its index.

Declaration

aqObjMethodObj.ParamName(Index)

Read-Only Property String
aqObjMethodObj An expression, variable or parameter that specifies a reference to an aqObjMethod object
Index [in]    Required    Integer    

Applies To

The property is applied to the following object:

Parameters

The property has the following parameter:

Index

The zero-based index of the desired parameter in the list of method parameters. To get the total number of method parameters, use the aqObjMethodObj.ParamCount property.

Property Value

A string that holds the parameter name.

Remarks

If you use Python or DelphiScript, you should enclose the parameter of the ParamName property in square brackets: ParamName[Index].

Example

The code below obtains the collection of all parameters that belong to the Click method of Notepad' s main window object. After that, the routine obtains the total number of the specified method's parameters and posts the parameter names to the test log.

JavaScript, JScript

function GettingMethodParameters()
{

  // Launches notepad.exe
  WshShell.Run("notepad.exe", SW_NORMAL);
  
  // Specifies the object
  var Obj = Sys.Process("notepad").Window("Notepad", "Untitled - Notepad", 1);
  
  // Obtains information about the Click method
  var MethItem = aqObject.GetMethods(Obj).Item(1);
    
  // Obtains the number of the method's parameters
  Num = MethItem.ParamCount;
  
  for (var i = 0; i < Num; i++)
    // Posts the parameter name to the test log
    Log.Message( MethItem.ParamName(i) );
    
  // Closes notepad.exe
  Sys.Process("notepad").Terminate();
    
}

Python

def GettingMethodParameters():
  # Launches notepad.exe
  WshShell.Run("notepad.exe", SW_NORMAL)
  # Specifies the object
  Obj = Sys.Process("notepad").Window("Notepad", "Untitled - Notepad", 1)
  # Obtains information about the Click method
  MethItem = aqObject.GetMethods(Obj).Item(1)
  # Obtains the number of the method's parameters
  Num = MethItem.ParamCount
  for i in range(0, Num):
    # Posts the parameter name to the test log
    Log.Message(MethItem.ParamName[i])
  # Closes notepad.exe
  Sys.Process("notepad").Terminate()

VBScript

Sub GettingMethodParameters

  ' Launches notepad.exe
  Call WshShell.Run("notepad.exe", SW_NORMAL)
  
  ' Specifies the object
  Set Obj = Sys.Process("notepad").Window("Notepad", "Untitled - Notepad", 1)
  
  ' Obtains information about the Click method
  Set MethItem = aqObject.GetMethods(Obj).Item(1)
    
  ' Obtains the number of the method's parameters
  Num = MethItem.ParamCount
  
  For i = 0 to Num-1
    ' Posts the parameter name to the test log
    Log.Message( MethItem.ParamName(i) )
  Next
    
  ' Closes notepad.exe
  Sys.Process("notepad").Terminate
    
End Sub

DelphiScript

function GettingMethodParameters;
var Obj, MethItem, Num, i;
begin

  // Launches notepad.exe
  WshShell.Run('notepad.exe', SW_NORMAL);
  
  // Specifies the object
  Obj := Sys.Process('notepad').Window('Notepad', 'Untitled - Notepad', 1);
  
  // Obtains information about the Click method
  MethItem := aqObject.GetMethods(Obj).Item(1);
    
  // Obtains the number of the method's parameters
  Num := MethItem.ParamCount;
  
  for i := 0 to Num-1 do
    // Posts the parameter name to the test log
    Log.Message( MethItem.ParamName[i] );
    
  // Closes notepad.exe
  Sys.Process('notepad').Terminate();
    
end;

C++Script, C#Script

function GettingMethodParameters()
{

  // Launches notepad.exe
  WshShell["Run"]("notepad.exe", SW_NORMAL);
  
  // Specifies the object
  var Obj = Sys["Process"]("notepad")["Window"]("Notepad", "Untitled - Notepad", 1);
  
  // Obtains information about the Click method
  var MethItem = aqObject["GetMethods"](Obj)["Item"](1);
    
  // Obtains the number of the method's parameters
  Num = MethItem["ParamCount"];
  
  for (var i = 0; i < Num; i++)
    // Posts the parameter name to the test log
    Log["Message"]( MethItem["ParamName"](i) );
    
  // Closes notepad.exe
  Sys["Process"]("notepad")["Terminate"]();
    
}

See Also

HasRetValue Method
Name Property
ParamCount Property
ParamType Property
ValueType Property

Highlight search results