Forum Discussion

dhundley's avatar
Regular Contributor
3 years ago

event handler javascript for an unexpected winformsobject window

I have a modal popup that occurs quite frequently in my desktop application. it is simply a status message box that pops up and goes away on its own after a few seconds or as much as a minute, however, in the namemapping/objectbrowseer it shows up defined as a WinFormsObject rather that a Window (see attached image of the objectbrowser for this object). I am trying to add this to my GeneralEvents_OnUnexpectedWindow event handler where I have created the script that handles Window popups but the appearance of the status box in my application never seems to trigger this event handler. (see attached image of javascript code). Can a WinFormsObject be handled within this event handler or will it only handle something that is defined as a Window?

5 Replies

    • dhundley's avatar
      Regular Contributor



      that link did truly help me get quite a bit farther along. the only problem I have now is more of a performance issue. in the linked article it states


      TestComplete only checks for unexpected windows when the test performs an action (ClickDblClickActivate, etc.). 


      so the popup window can sometimes sit there for a long time before the handler is getting invoked to handle it. You can see that the popup was on my screen for more than a minute and a half before the event handler (which contains the Log.Message that put “Popup detected” message in the log attached image) kicked in and handled it. I need to figure out something that will force this to happen much sooner.

      • Marsha_R's avatar
        Champion Level 3

        That's under this part in that same documentation.  Try changing your timeout value.