Ask a Question

event handler javascript for an unexpected winformsobject window

SOLVED
dhundley
Frequent Contributor

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 5
Marsha_R
Community Hero

Here's an explanation and examples that may help you out.

https://support.smartbear.com/testcomplete/docs/testing-with/running/handling-errors/unexpected-wind...


Marsha_R
[Community Hero]
____
[Community Heroes] 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 Heroes]
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 Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
dhundley
Frequent Contributor

Marsha,

 

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.

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

 

  1. Marsha_R_0-1646342795145.png

     

 

 


Marsha_R
[Community Hero]
____
[Community Heroes] 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 Heroes]
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 Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
dhundley
Frequent Contributor

i'm sure i can get it working by playing around with the timeout. thanks!

You're welcome!  Let us know what worked for you.  It may help someone else down the road.


Marsha_R
[Community Hero]
____
[Community Heroes] 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 Heroes]
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 Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
cancel
Showing results for 
Search instead for 
Did you mean: