Forum Discussion
Dmitry_Nikolaev
Staff
15 years agoHello 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?