VCLNETObject Method (Window Objects)

Applies to TestComplete 15.45, last modified on December 01, 2022

Description

Use this method to obtain a scripting interface to the specified window or control of a .NET application created with Borland VCL.NET. The resulting object contains methods and properties defined in the application code as well as methods, properties and actions provided by TestComplete.

Declaration

TestObj.VCLNETObject(Name)

TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
Name [in]    Required    String    
Result Object

TestObj.VCLNETObject(ClassName, WndCaption)

TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
ClassName [in]    Required    String    
WndCaption [in]    Required    String    
Result Object

TestObj.VCLNETObject(ClassName, WndCaption, Index)

TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
ClassName [in]    Required    String    
WndCaption [in]    Required    String    
Index [in]    Required    Integer    
Result Object

TestObj.VCLNETObject(ClassName, Index)

TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
ClassName [in]    Required    String    
Index [in]    Required    Integer    
Result Object

Applies To

The method is applied to the following object:

View Mode

To view this method in the Object Browser panel and in other panels and dialogs, activate the Advanced view mode.

Parameters

The method has the following parameters:

Name

The name of the desired object as it is specified in the tested application’s source code (the string that is returned by the object’s “native” Name property).

Note that objects created at run time may have no name specified. In this case, use the second implementation of the method to address the desired object.

ClassName

The window’s class name is specified by the application code (not by the operating system’s class name). You should specify a short class name, for instance, TButton, rather than Borland.Vcl.StdCtrls.TButton. You can use wildcards (* and ?) in this parameter.

Note that class names may be unavailable. For instance, this happens if a .NET application was processed with an obfuscator. In this case, TestComplete replaces the class name with an underscore and an index. To determine the class name used, explore your application in the Object Browser.

WndCaption

Caption of the desired window. You can use wildcards (* and ?) in this parameter.

Index

Index of the window among other windows that belong to the WindowObj object and that have the same class name and caption.

The Index parameter is used only if an object contains two or more child objects that have the same class name and caption. It is used to distinguish these objects from each other. The first found object has an index of 1, the second -  2 and so on.
If there is only one child object with the specified class name and caption, index should not be specified. To decide whether the index should be used, explore your application in the Object Browser panel and use the naming format that is used by the panel.

Result Value

The VCLNETObject method returns an object that provides a scripting interface to an object located in a VCL.NET application (.NET applications are always “open” to TestComplete). If TestComplete cannot access the specified object (for example, this object does not exist), VCLNETObject will return an empty stub object and post an error message to the test log. To determine whether the method returns a valid object, use the Exists property of the resultant object. If Exists returns False, then the returned object is a stub object and the call to VCLNETObject was not successful.

Remarks

If you use only one parameter, TestComplete considers the use of the first VCLNETObject method implementation and the parameter as the object’s name. If you use two or three parameters, TestComplete considers it as using the second or third implementation.

The fourth implementation is used to address non-windowed controls of application forms. For instance, it is used to address TLabel objects.

The object returned by the VCLNETObject method contains 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. If 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 NativeClrObject namespace.

The VCLNETObject method is available only if the .NET Application Support plugin is installed and enabled in File | Install Extensions. Otherwise, the method is absent in the method list of the Window object.
If the plugin is installed, you cannot use the Window method to address windows of your .NET application, you should use VCLNETObject instead.

For more information about the VCL.NET object naming syntax, see Addressing Objects in .NET Applications.

See Also

WaitVCLNETObject Method (Window Objects)
Testing .NET Applications
Addressing Objects in .NET Applications
WinFormsObject Method
VCLNETObject Method (Process Objects)

Highlight search results