Use this method to obtain a scripting interface to the specified object of an Open Application that was created in Borland Delphi, CodeGear Delphi, Embarcadero Delphi, Borland C++Builder, CodeGear C++Builder or Embarcadero C++Builder using VCL classes. The resulting object contains both VCL and TestComplete methods, properties, events and actions.
|TestObj||A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section|
The method is applied to the following objects:
To view this method in the Object Browser panel and in other panels and dialogs, activate the Advanced view mode.
The method has the following parameter:
The name of the desired object. This can be the object name as it is specified in the tested application’s source code (the string that is returned by the object’s “native”
Name property) or the name generated by TestComplete (when the “native”
Name property is empty). TestComplete generates the name using the object’s class name (for example, TEdit) and an index. To learn the generated name, explore your application in the Object Browser.
VCLObject method returns an object that provides a scripting interface to an object located in an Open Application that was created in Delphi or C++Builder using VCL classes. If TestComplete cannot access the specified object (for example, this object does not exist), the method will return an empty stub object and post an error message to the test log. To determine whether
VCLObject returns a valid object, use the
Exists property of the resultant object. If this property returns False, then the returned object is a stub object and the call to
VCLObject was not successful.
The returned object contains both methods and properties defined in the application code as well as methods, properties and actions provided by TestComplete. The returned object may hold two or more methods and properties having the same name. When you call such a method or property, a naming conflict will occur. To avoid it and to specify which method or property is to be called, use the NativeDelphiObject namespace.
The methods and properties provided by TestComplete can be applied to the returned object only if the object is visible. Otherwise, the methods and properties are not available, an the Object not found error occurs.
To work around this issue, you can:
Use similar native properties and methods of the underlying VCL object instead of the methods and properties provided by TestComplete. For example, to get the number of combo box items, you can use the native
VCLObject("ComboBox").Items.Count property instead of the
VCLObject("ComboBox").wItemCount property provided by TestComplete.
To find a suitable native property or method, locate the problematic object in the Object Browser and check its members.
Call properties or methods provided by TestComplete when the needed object is visible. For example, if your application requires some actions to make an object visible:
On the test design stage: Add a call to a method or property after these actions are performed.
On the test run stage: Call the method or property when the object is visible.
The method is available only if the Delphi and C++Builder Application Support plugin is installed and enabled in TestComplete. Otherwise, the method is absent in the method list of the
If the plugin is installed, you cannot use the
To view an example that demonstrates how to use the
VCLObject method, see Working With Specific In-place Editors in Developer Express QuantumGrid.
Addressing Objects in Delphi Applications
Addressing Objects in C++Builder Applications
Object Browser Naming Notation
About Open Applications