Name Property

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

Description

Use the Name property to obtain the name of a property to which StoredObjectProperty provides access to.

Declaration

StoredObjectPropertyObj.Name

Read-Only Property String
StoredObjectPropertyObj An expression, variable or parameter that specifies a reference to a StoredObjectProperty object

Applies To

The property is applied to the following object:

Property Value

String holding the property name.

Example

The following code demonstrates how you can access the desired item of the Objects collection and the properties stored in this item.

JavaScript, JScript

function Test1()
{
  // Obtains the specified property collection
  StoredObject = Objects.Items("MyCollection");
  Log.Message("The total number of property values stored by the collection: " + StoredObject.PropertyCount);

  // Access the specified stored property
  StoredObjectProperty = StoredObject.Properties(0);
    // --or--
  // StoredObjectProperty = StoredObject.PropertyByName("Caption");
  PropertyName = StoredObjectProperty.Name;
  PropertyValue = StoredObjectProperty.Value;
  Log.Message(PropertyName + " = " + PropertyValue);
}

Python

def Test1():
  # Obtains the specified property collection 
  StoredObject = Objects.Items("MyCollection")
  Log.Message("The total number of property values stored by the collection: " + str(StoredObject.PropertyCount))
  # Access the specified stored property  
  StoredObjectProperty = StoredObject.Properties[0]
  # --or-- 
  # StoredObjectProperty = StoredObject.PropertyByName["Caption"]
  PropertyName = StoredObjectProperty.Name 
  PropertyValue = StoredObjectProperty.Value
  Log.Message(PropertyName + " = " + str(PropertyValue))

VBScript

Sub Test1
  ' Obtains the specified property collection
  Set StoredObject = Objects.Items("MyCollection")
  Log.Message("The total number of property values stored by the collection: " & StoredObject.PropertyCount)

  ' Access the specified stored property
  Set StoredObjectProperty = StoredObject.Properties(0)
    ' --or--
  ' Set StoredObjectProperty = StoredObject.PropertyByName("Caption")
  PropertyName = StoredObjectProperty.Name
  PropertyValue = StoredObjectProperty.Value
  Log.Message(PropertyName & " = " & PropertyValue)
End Sub

DelphiScript

procedure Test1;
begin
  // Obtains the specified property collection
  StoredObject := Objects.Items('MyCollection');
  Log.Message('The total number of property values stored by the collection: ' + StoredObject.PropertyCount);

  // Access the specified stored property
  StoredObjectProperty := StoredObject.Properties(0);
    // --or--
  // StoredObjectProperty := StoredObject.PropertyByName('Caption');
  PropertyName := StoredObjectProperty.Name;
  PropertyValue := StoredObjectProperty.Value;
  Log.Message(PropertyName + ' = ' + PropertyValue);
end;

C++Script, C#Script

function Test1()
{
  // Obtains the specified property collection
  StoredObject = Objects["Items"]("MyCollection");
  Log["Message"]("The total number of property values stored by the collection: " + StoredObject["PropertyCount"]);

  // Access the specified stored property
  StoredObjectProperty = StoredObject["Properties"](0);
    // --or--
  // StoredObjectProperty = StoredObject["PropertyByName"]("Caption");
  PropertyName = StoredObjectProperty["Name"];
  PropertyValue = StoredObjectProperty["Value"];
  Log["Message"](PropertyName + " = " + PropertyValue);
}

See Also

Value Property
PropertyByName Property

Highlight search results