CallObjectMethodAsyncResult Object

Applies to TestComplete 15.70, last modified on December 17, 2024

Description

The CallObjectMethodAsyncResult object is returned by the Runner.CallObjectMethodAsync and SetObjectPropertyAsync methods that are used to call an application’s object methods and properties in scripts asynchronously. Using methods and properties of the CallObjectMethodAsyncResult object, you can pause the script’s execution until the call to the application method is over and check the method’s result value.

Members

Example

The code below demonstrates how you can use methods of the CallObjectMethodAsync object.

JavaScript, JScript

function CallObjectMethodAsyncExample()
{
  // Calls method asynchronously
  var CallResultObj = Runner.CallObjectMethodAsync(Obj, "MethodName", "Param1", "Param2");
 
  // Performs the desired user actions
  // ...
 
  // Waits until the asynchronous call is over
  while (! CallResultObj.Completed )
    aqUtils.Delay(100);
 
  // Checks the results
  MethodResult = CallResultObj.ReturnValue;
}

Python

def CallObjectMethodAsyncExample():
  # Calls method asynchronously 
  CallResultObj = Runner.CallObjectMethodAsync(Obj, "MethodName", "Param1", "Param2")
  # Performs the desired user actions 
  # ... 
  # Waits until the asynchronous call is over 
  while not CallResultObj.Completed:
    aqUtils.Delay(100)
  # Checks the results 
  MethodResult = CallResultObj.ReturnValue

VBScript

Sub CallObjectMethodAsyncExample
  ' Calls method asynchronously
  Set CallResultObj = Runner.CallObjectMethodAsync(Obj, "MethodName", "Param1", "Param2")
 
  ' Performs the desired user actions
  ' ...
 
  ' Waits until the asynchronous call is over
  While Not CallResultObj.Completed
    aqUtils.Delay 100
  WEnd
 
  ' Checks the results
  MethodResult = CallResultObj.ReturnValue
End Sub

DelphiScript

function CallObjectMethodAsyncExample;
var CallResultObj, MethodResult;
begin
  // Calls method asynchronously
  CallResultObj := Runner.CallObjectMethodAsync(Obj, 'MethodName', 'Param1', 'Param2');
 
  // Performs the desired user actions
  // ...
 
  // Waits until the asynchronous call is over
  while (not CallResultObj.Completed ) do
    aqUtils.Delay(100);
 
  // Checks the results
  MethodResult := CallResultObj.ReturnValue;
end;

C++Script, C#Script

function CallObjectMethodAsyncExample()
{
  // Calls method asynchronously
  var CallResultObj = Runner["CallObjectMethodAsync"]( Obj, "MethodName", "Param1", "Param2" );
 
  // Performs the desired user actions
  // ...
 
  // Waits until the asynchronous call is over
  while (! CallResultObj["Completed"] )
    aqUtils["Delay"](100);
 
  // Checks the results
  MethodResult = CallResultObj["ReturnValue"];
}

See Also

Calling Methods Asynchronously
Testing Modal Windows

Highlight search results