Value Property

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

The object-driven testing (ODT) functionality is deprecated. Do not use it to create new tests. It will be removed from the product in one of the future releases. As an alternative, you can create custom classes in your scripts. For more information, see Alternatives to the ODT functionality.

Description

Use the Property.Value property to get or set the value of the ODT object property from scripts.

Declaration

PropertyObj.Value

Read-Write Property Variant
PropertyObj An expression, variable or parameter that specifies a reference to a Property object

Applies To

The property is applied to the following object:

Property Value

The value of the specified property. It can be any OLEVariant-compatible value: string, integer, object reference, array, etc.

Remarks

The Value property is used by default in the Property object, so you can omit it when addressing the item value. For instance, the following two lines are equivalent:

JavaScript, JScript

MyObject.MyProperty.Value = 10;
MyObject.MyProperty = 10;

VBScript

MyObject.MyProperty.Value = 10
MyObject.MyProperty = 10

DelphiScript

MyObject.MyProperty.Value := 10;
MyObject.MyProperty := 10;

C++Script, C#Script

MyObject["MyProperty"]Value = 10;
MyObject["MyProperty"] = 10;

Example

The following example demonstrates how to get access to properties of an object created in script and how to specify a property’s value.

JavaScript, JScript

function PropertySample()
{
  var PropertyObj, Obj;
  // Creates an object
  Obj = ODT.Classes.New("SampleClass");
  // Gets access to the object’s property
  PropertyObj = Obj.Properties(0);
  // Specifies the property’s value
  PropertyObj.Value = "New Value";
  …

}

VBScript

Sub PropertySample

  Dim PropertyObj, Obj
  ' Creates an object
  Set Obj = ODT.Classes.New("SampleClass")
  ' Gets access to the object’s property
  Set PropertyObj = Obj.Properties(0)
  ' Specifies the property’s value
  PropertyObj.Value = "New Value"
  …

End Sub

DelphiScript

procedure PropertySample();
var PropertyObj, Obj;
begin
  // Creates an object
  Obj := ODT.Classes.New('SampleClass');
  // Gets access to the object’s property
  PropertyObj := Obj.Properties[0];
  // Specifies the property’s value
  PropertyObj.Value := 'New Value';
  …

end;

C++Script, C#Script

function PropertySample()
{
  var PropertyObj, Obj;
  // Creates an object
  Obj = ODT["Classes"]["New"]("SampleClass");
  // Gets access to the object’s property
  PropertyObj = Obj["Properties"](0);
  // Specifies the property’s value
  PropertyObj["Value"] = "New Value";
  …

}

See Also

Value Property
Name Property
Object Object

Highlight search results