Forum Discussion

kakabubu's avatar
12 months ago

ComboBox.ClickItem Asynchronous object call failed

 I forced problems with one of my helper methods, which clicks the ComboBox item.
While debugging I assumed that problem was because ComboBox opens and closes (blinks) several times when I click an item.

Seems that it is caused by checking if cb.wItemList contains the required item before selecting it
So I've tried to remove that check, expecting something like "Item not found" error. Instead of it, I got "Asynchronous object call failed" error. 
I've tried to cover it on "try {} catch () {}" as it shown below:


try {// ts-ignore
      let callResult = Runner.CallObjectMethodAsync(list, 'ClickItem', itemText);
      while (!callResult.Completed) {
        if (!counter.check(dontLogError)) break;
        isSelected = waitSelected ? waitItemSelected(100) : callResult.Completed;
        if (isSelected) break;
    catch (e) {
      Log.Error('Error selecting "' + itemText + '": "' + e + '"\nAvailable items list: ' + list.wItemList);
      return false;
    return true;


but catching the error failed.

CallStack points me inside of waitSelectedItem(100), which is actually just 


 const waitItemSelected = (timeout = 0) => list.WaitProperty('Text', itemText, timeout);


Tried covering this method in "try {} catch () {}" didn't work

4 Replies

  • Kitt's avatar
    Regular Contributor

    Can you try using VAR instead of LET? Or stripping everything down to the TestComplete example [reference] using aqUtils.Delay(100):

    // Calls method asynchronously
    var callResult = Runner.CallObjectMethodAsync(list, 'ClickItem', itemText);
    // Performs the desired user actions
    // ...
    // Waits until the asynchronous call is over
    while (! callResult.Completed )
    // Checks the results
    MethodResult = callResult.ReturnValue;


    • kakabubu's avatar

      I'll try changing to 'var' and retest
      I removed all var a long time ago because they are available outside the scope.
      But the solution with callResult.Completed can not work in some cases, because I also checking if the item was already selected in a loop

    • kakabubu's avatar

      Tried changing to "var"
      Didn't worked
      Added aqUtils.Delay(500) now described error is thrown on row with this delay

  • Calling the same method synchronously throws the following error :
    The combo box item 'itemText' not found.


    That is actually exactly what I expect here, but I want to get in Async method call