aqObject Object

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

Description

The aqObject object provides unified methods for operating objects’ members at run time.

The object is available in TestComplete by default.

Note that it is possible to skip the object’s name (aqObject) when calling its members in scripts. For example, the following two lines are equivalent:

JavaScript, JScript

type = aqObject.GetVarType(x);
type = GetVarType(x);

Python

type = aqObject.GetVarType(x)
type = GetVarType(x)

VBScript

type = aqObject.GetVarType(x)
type = GetVarType(x)

DelphiScript

type := aqObject.GetVarType(x);
type := GetVarType(x);

C++Script, C#Script

type = aqObject["GetVarType"](x);
type = GetVarType(x);

Members

Example

The code below checks whether the PropertyName property is supported by the specified object. If it is, the routine sets a new value for this property. Otherwise, an error occurs.

JavaScript, JScript

function SettingPropertyValue()
{

   var app = Sys.Process("MyApplication");
   var prop = "PropertyName";
   
   // Checks whether the desired property is supported
   if ( aqObject.IsSupported(app, prop) )
      aqObject.SetPropertyValue(app, prop, "PropertyValue")
   else
      Log.Error("The specified property is not supported by the object.");
    
}

Python

def SettingPropertyValue():
  app = Sys.Process("MyApplication")
  prop = "PropertyName"
  # Checks whether the desired property is supported
  if aqObject.IsSupported(app, prop):
    aqObject.SetPropertyValue(app, prop, "PropertyValue")
  else:
    Log.Error("The specified property is not supported by the object.")

VBScript

Sub SettingPropertyValue

   Set app = Sys.Process("MyApplication")
   prop = "PropertyName"
   
   ' Checks whether the desired property is supported
   If aqObject.IsSupported(app, prop) Then 
      Call aqObject.SetPropertyValue(app, prop, "PropertyValue")
   Else
      Log.Error "The specified property is not supported by the object."
   End If
    
End Sub

DelphiScript

function SettingPropertyValue;
var app, prop;
begin

   app := Sys.Process('MyApplication');
   prop := 'PropertyName';
   
   // Checks whether the desired property is supported
   if ( aqObject.IsSupported(app, prop) ) then
      aqObject.SetPropertyValue(app, prop, 'PropertyValue')
   else
      Log.Error('The specified property is not supported by the object.');
    
end;

C++Script, C#Script

function SettingPropertyValue()
{

   var app = Sys["Process"]("MyApplication");
   var prop = "PropertyName";
   
   // Checks whether the desired property is supported
   if ( aqObject["IsSupported"]( app, prop ) )
      aqObject["SetPropertyValue"]( app, prop, "PropertyValue" )
   else
      Log["Error"]("The specified property is not supported by the object.");
    
}

See Also

TestComplete Helper Objects
aqConvert Object
aqDateTime Object
aqEnvironment Object
aqFile Object
aqFileSystem Object
aqString Object
aqUtils Object

Highlight search results