Sometimes, at the point of scripts being executed in an application at hand, there are windows or other controls elements being simultaneously opened to overlap the controls elements that are being referred to by the scripts, at the given moment of time. As a result, in the log, there appear error messages.
Overlapping window is the window that overrides the controls element, which TestComplete is handling at the moment; however, it does not block the working with the controls element.
In this recipe, we will learn to rid ourselves of the previous-mentioned error in the simplest manner imaginable.
In order to deal with overlapping windows we need to perform the following steps:
function testOverlappingWindow() { var wNotepad = Sys.Process("NOTEPAD").Window("Notepad", "*"); edit = wNotepad.Window("Edit"); edit.Keys("first string[Enter]"); wNotepad.MainMenu.Click("Edit|Find..."); edit.Click(100, 120); edit.Keys("second string"); var wFind = Sys.Process("NOTEPAD").Window("#32770", "Find"); wFind.Window("Button", "Cancel").ClickButton(); }
edit.Click(100, 120);
change the parameters that are being passed to the method so that the mouse-click would be made at a point close by the Find window (you might need several tries to find the correct coordinates). Launch the function.First we try to run the function which clicks on an object which is hidden by another window. As a result, an error message is put to the log showing that overlapping window prevents TestComplete performing the click action.
After we had made changes to project options, the error wasn't sent to the log again.
The example with the Find window in Notepad shows that error with overlapping windows isn't critical, since the script keeps successfully on after posting an error. Another example of such a behavior is an invisible controls element, which is located above the targeted element in mind, however, not standing in the script's way. Since such messages in the log may hinder us, we can simply ignore them, as shown in this recipe.
If the window is blocking script workings with the application, it is called Unexpected, not Overlapping. In Playback group of project settings, one can customize behavior of TestComplete at work with the same windows, and we will also get to grip with the way to process those from the scripts in Chapter 12, Events Handling.