Ask a Question

TestComplete on Unexpected Window handler not working

Occasional Contributor

TestComplete on Unexpected Window handler not working

Hi there,


We have a large java swing based application with many modal pop ups and windows. In our project properties -> playback, under "On Unexpected window" I have enabled the checkboxes that press 'esc', 'enter', 'send the close command', and 'click on focused control'. However this has never worked (even since TestComplete 😎 when we encounter unexpected windows from our application. I am wondering if those modals/windows that show up unexpectedly during the test are not considered an "unexpected" windows to TestComplete, since it is still part of our application.

If that is the case, we would have to write specific handlers depending on which modal/window exists (ex: if (Aliases.blah.exists(1000) do....) which would be very slow and unnacceptable.

Is there a way to define which windows would be "unexpected" or some other alternative solution?



Champion Level 3

Hi Dan,


Soungs strange...

One more guess: can you double check that the event handling routine in your test project is properly linked to the event?


  /Alex [Community Champion]
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
Occasional Contributor

Hi Alex,


Yes we have an unexpected window event set up, which is connected to a method in a file which I have tested and certainly does work however now I am wondering what the priority of that custom handler is. Does TC first try the default handler then the custom unexpected event handler? It seems like it skips the default handler and enters the custom unexpected window handler.

Also I have heard from other discussion on this board that anything that has to do with the expected application will never be an unexpected window, only truly unexpected windows such as a windows update or such. Is this true?




Showing results for 
Search instead for 
Did you mean: