WaitJavaRuntime Method

Applies to TestComplete 15.62, last modified on March 19, 2024

Description

Use this method to pause the test execution until the specified Java runtime instance loaded to the process becomes available to TestComplete. The method returns a program object that provides access to the Java virtual machine loaded to the process.

Declaration

TestObj.WaitJavaRuntime(Index, Timeout)

TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
Index [in]    Required    Integer    
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:

Index

Specifies the zero-based index of the desired Java virtual machine among those loaded to the process. The default value is 0. To get the total number of Java virtual machines loaded to a process, use the JavaVMCount property.

Timeout

The number of milliseconds to wait until the specified Java runtime instance becomes available. If Timeout is 0, the method is returned immediately. If Timeout is -1, the waiting time is infinite.

Note that the Timeout value is not strict and if the tested application is busy, TestComplete can wait for the object longer than it is specified by the parameter. This can be caused by the following:

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 WaitJavaRuntime method returns a JavaRuntime object that provides access to a Java virtual machine loaded to the specified process. If TestComplete cannot access the specified Java runtime instance (for example, this object does not exist), the method returns an empty stub object. To determine whether WaitJavaRuntime 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 WaitJavaRuntime was not successful.

Remarks

The WaitJavaRuntime method is available only if the Java Application Support and JavaFX Application Support plugins are installed.

See Also

Addressing Objects in JavaFX Applications
Object Browser Naming Notation
Using Namespaces
About Open Applications
JavaRuntime Method

Highlight search results