WaitAppDomain Method

Applies to TestComplete 14.72, last modified on January 20, 2021


Use this method to delay the script execution until the specified .NET application domain becomes available. The method returns a program object that provides a scripting interface to the specified domain. The returned object contains methods and properties defined in the application code as well as methods, properties and actions provided by TestComplete.

There are two implementations of this method:



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


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    
ClrVersion [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.


The method has the following parameters:


The friendly name of the application domain. This name is specified by the domain’s native FriendlyName property value.

The friendly name of the default application domain is the same as the file name of the application executable. For example, if the application file name is Orders.exe, the friendly name of its default domain is "Orders.exe".

Note that a process can have multiple application domains with different names.


This parameter is only used if the application hosts multiple CLR versions in the same process, for example, .NET 4.0 runtime and .NET 2.0 runtime. It specifies the CLR version of the application domain that you wish to obtain. The version number string must have the "major_version.minor_version" format. For example, "4.0" or "2.0".


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 method returns the AppDomain object that provides a scripting interface to the application domain. This object is a wrapper over the .NET Framework AppDomain object. For more information about the object and its properties and methods, see the AppDomain Class article in the MSDN library.

If the specified domain has not become available during the waiting period (that is, the corresponding AppDomain object does not exist), the method returns 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 the WaitAppDomain method was not successful.


The AppDomain method is available only if the .NET Application Support plugin is installed and enabled in File | Install Extensions.

See Also

AppDomain Object
AppDomain Method
Testing .NET Applications
Accessing Native Properties and Methods of .NET Objects
Accessing Non-Visual Objects in .NET Applications
Creating Instances of .NET Classes Defined in Applications

Highlight search results