Forum Discussion

pichumani's avatar
pichumani
Frequent Visitor
4 hours ago

Unexpected Window event is fired only once.

I am testing WPF application. And i have configured a UnexpectedWindow event via Events--> EventControl.  The Event is fired only for the first time an unexpected window appears.

For the subsequent unexpected windows, The Event is not fired

 

For reference, The Sequence is as follows:

1.) some test steps

2.) unwanted dialog appears -> event fired and handled properly

3.) some test steps 

4.) unwanted window appears -> no events fired, timeout and error.

 


am i missing something ? should configure something so that event is fired every time ?

 

 

TestComplete Version: 15.80.1.7 x64

1 Reply

  • Hassan_Ballan's avatar
    Hassan_Ballan
    Icon for Champion Level 3 rankChampion Level 3

    In TestComplete this usually happens for one of these reasons:

    Most commonly (especially with WPF apps), the dialog isn’t actually being recreated the second time — it’s just being hidden and shown again. If the window object never gets destroyed, TestComplete doesn’t treat it as a “new” unexpected window, so the event won’t fire again. You can confirm this in Object Browser by checking whether the window truly disappears from the hierarchy or just toggles Visible, rather than being removed completely.

    Other things worth checking:

    • Make sure the event is still enabled under Project → Properties → Events
    • Verify the second dialog really matches the same process/class/caption (sometimes the caption text, parent, or index changes slightly)
    • Ensure it wasn’t added to Name Mapping after the first run. If it’s mapped (or falls under a mapped parent), TestComplete may now treat it as a known object instead of an unexpected one, so the event won’t trigger
    • Increase the Auto-wait timeout in case the test step fails before the event handler has a chance to execute

    If this resolves your scenario, marking it as the solution helps future readers find it quickly.