Forum Discussion

vlad230's avatar
vlad230
Contributor
12 years ago

WaitWindow() issues

Hi guys,



I'm encountering some issues with the WaitWindow() function from TestComplete 9.



I have built a function that waits until a window is displayed using WaitWindow() but the problem is that sometimes it doesn't work - the window appears on screen but TestComplete still waits for it.



Here's my code:



function WaitforWindow(process, WndClass, WndCaption){

  var p, w, i;

  i = 0;

  p = Sys.Process(process);

  while(1){

    w = p.WaitWindow(WndClass, WndCaption, -1, 5000);

    i = i + 1;

    if ( (w.Exists && w.VisibleOnScreen) || (i > 20) )

      break;

  }

  if (! (w.Exists && w.VisibleOnScreen))

    Log.Error("Window not found.");

  else

    Log.Message("Window was found.");

    

  return w;    

}





Any thoughts on this?



Thanks,

Sergiu

5 Replies

  • hlalumiere's avatar
    hlalumiere
    Regular Contributor
    I am pretty sure this is the same issue everyone else is experiencing with TC9 performance wise. WaitWindow or FindChild or FindAllChildren all have the same problem, sometimes they will only detect the window after the timeout has fully passed, for no reason at all. I suggest someone escalates this on your end and actually take a look at reproducing it, as I and others see this issue reoccurring routinely in TC9. This is the one major performance issue I have with TC9.



    Besides, reading his code, he does wait 5 seconds every time, he just retries 20 times. 5 seconds is an eternity for a programmer.
  • Hi guys,



    Thanks for the replies.



    Indeed this is an intermittent issue that is bugging me.



    If this is a known issue, is there a time frame in which we can expect it to be fixed ? Or is there any change we can get a quick fix for this?



    I remember that this wasn't reproducing when using TC 8.7  so maybe this can be a good point to start from.



    Thanks,

    Sergiu
  • aqAnt's avatar
    aqAnt
    SmartBear Alumni (Retired)

    Hi All,


    I guess that the method calls fail under certain conditions in each case. I would appreciate it if you contacted us via our Contact Support form and provided details about the conditions such as:



    • the type of your application under test (name and version of the IDE);

    • the name and version of components with which the method calls fail;

    • whether the performance tips are applied or not;

    • whether the variation of Depth or Timeout parameter helps.