Description
Use the IsSupported
method to verify whether a particular object has a property, field, method or event with the specified name. Thus, you can determine whether the member is supported.
Declaration
aqObject.IsSupported(IObject, MemberName)
IObject | [in] | Required | Variant | |
MemberName | [in] | Required | String | |
Result | Boolean |
Applies To
The method is applied to the following object:
Parameters
The method has the following parameters:
IObject
Specifies the object whose members should be verified.
MemberName
A string that defines the name of the sought-for member.
Result Value
True if the object has the specified property, field, method or event, and False otherwise.
Remarks
When the method is used to check members of a stub object, it returns True for any member name. A stub object is a special helper object used by TestComplete objects' methods that return references to other objects. You can use the CreateStubObject
method to create such objects in tests.
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
aqObject.GetProperties Method
aqObject.GetFields Method
aqObject.GetMethods Method
aqObject.GetEvents Method