Forum Discussion

steve4king's avatar
steve4king
Occasional Contributor
15 years ago

Stop on Window Recognition error - never stops..

I know the documentation says, "Not counting Auto-Wait Timeout cases.." 

But everything that calls a window has an auto-wait timeout.. so how can I force this to trigger?



I'm trying to handle unexpected (not technically modal) windows.. and 90% of the time, I don't want my test to continue running down the list if one window doesn't exist.  It looks like I'm going to have to add annoying little loops at every user interaction to look for non-modal error messages that prevent the test from progressing.



Main question I guess.. How can I get stop on window recognition error to fire? (How do I disable auto-wait timeout for certain operations so that it will fire?)



Thanks!



-Stephen

1 Reply


  • Hello Stephen,





    As far as I understand your essential task, you want to stop the test in some cases when TestComplete posts an "Object does not exist" error or another kind of error in the test log. Please confirm that I understand your task correctly. 

    There are two possible solutions to this problem (you can use one and/or the other of the two approaches):





    1. Wherever you need to stop the test if the needed window is not found, replace calls to the Window method with calls to the WaitWindow method. For example:







    p = Sys.Process("Notepad");

    // Waits 10 seconds for the window

    w = p.WaitWindow("*", "Open*", -1, 10000);

    if (!w.Exists)

    {

       // post an error message if necessary 

    }







    See the Waiting for a Process or Window Activation help topic in this relation.





    2. Handle the OnLogError event and, in the event handler, fetch the error text via the LogParams parameter and stop the script if necessary. For more information, refer to the Creating an Event Handler for the OnLogError Event help topic.





    Does this help?