WaitVCLNETObject Method (Process Objects)

Applies to TestComplete 14.30, last modified on November 21, 2019

Description

Use this method to pause the script execution until the specified object of a .NET application created with Borland VCL.NET classes, becomes available to TestComplete. The method returns a program object that provides a scripting interface to the specified window or control. The resulting object contains both methods and properties defined in application code as well as methods, properties and actions provided by TestComplete.

Declaration

TestObj.WaitVCLNETObject(NameTimeout)

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    
Timeout [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 processObj 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.

Timeout

The number of milliseconds to wait until the specified object becomes available. If Timeout is 0, the method returns immediately. If Timeout is -1, the wait time is infinite.

Note that Timeout value is not strict and if the tested application is busy, TestComplete could wait for the object for a longer period of time than it is specified by the parameter. The following can cause this:

A call to any WaitXXXObject method causes the object tree to refresh. To update object data, TestComplete may call some of object’s native methods that are accessible only from the application’s thread. When the thread is busy, TestComplete tries to call those methods during some pre-defined time (one second) thus delaying the refresh. There could be several attempts to get the object’s data which could result in a noticeable difference from the Timeout value.

Result Value

The WaitVCLNETObject method returns an object that provides a scripting interface to an object located in a .NET application created with Borland VCL.NET library (.NET applications are always “open” to TestComplete). If TestComplete cannot access the specified object (for example, this object does not exist), WaitVCLNETObject will return an empty stub object. 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 WaitVCLNETObject was not successful.

Remarks

If you use two parameters, TestComplete considers the use of the first implementation of the WaitVCLNETObject method. If you use three or four parameters, TestComplete considers it as using the second or third implementation.

The object returned by the WaitVCLNETObject method contains methods and properties defined in the application code as well as methods, properties and actions provided by TestComplete. The returned object may contain two or more methods and properties that have 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 WaitVCLNETObject 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 process object.

See Also

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

Highlight search results