Ask a Question

How to handle UnexpectedWindow/Overlapping window using the script or General Events?


How to handle UnexpectedWindow/Overlapping window using the script or General Events?

Hi All,


My application throws popup for every 3-5 Min. Script can proceed further by clicking on Ok button in the popup.


But how to recognise this popup using testcomplete dynamically?


Ex: While running the script, In middle if any popup appears TestComplete is not triggering it as UnexpectedWindow/Overlapping window. So that the webpage objects are going to "VisibleOnScreen=False" due to this popup. If objects are in Invisible state, we can't proceed further.


Please find the screen shot of the unwanted popup in the application and also Let me know if your require any other details in this regard.










May be you will find something useful in this topic >>

Hi Baxatob,


Thanks for solution, but my scenario is when ever Ingestion is in process, the modal dialog occurs., So we are not sure when that dialog occurs during 500 testcases run, and we cant write CallObjectMethodAsync in every test case.


Hope this wont work as expected, So can you suggest the another solution.


Thanks, BommaReddy

What happens if this window is opened? Does your test fail and throw some kind of error message? If so, you can try to handle your case using OnLogError event. You can check this window existence each time, when TC posts an error message to the log. 

Hi All,


As a workaround, I got the better solution to handle Windowless popup(Model Based popup) 


By using Timer Object we can overcome this problem. Write the following code in event handlers.



Sub OnStartTest(Sender)
  Dim MyTimer
  Set MyTimer = Utils.Timers.Add(8000, "unit1.TimerRoutine", True)
  MyTimer.Name = "ModelPopUp"
  Log.Message "Timer ON"
End Sub


Sub OnStopTest(Sender)
  Utils.Timers.Items("ModelPopUp").Enabled = False
  Log.Message "Timer OFF"
End Sub


Function TimerRoutine
  'write the code to check whether popup exists or Not
  If popup=True Then
     'close popup (or) Click
  End If
End Function

Before script starts, the controller will go to OnStartTest and activate Timer Object. Once Timer triggers, TestComplete pauses the test to run the timer’s routine. The test is resumed after the timer routine has finished running.


So for every 8sec, i am checking whether Windowless popup(Model Based popup) exists or not. For more details on Timer object click here





Occasional Contributor



What's 'unit1' here. I don't understand. Talking in Javascrip context, I was testing this and instead of unitname.timeRoutine, I'm using just the routine name and I get this error.

MyTimer = Utils.Timers.Add(10000, "StartUp.timeRoutine", true);


do you know why that would happen? 


Unable to find the timer procedure "timeRoutine".


Thank you


Esteemed Contributor



This thread is almost three years old and so a lot of context might have been lost.  It is entirely possible that the error that you're experience is unrelated.

Please post your question in a separate thread as this one has been marked resolved.

Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Occasional Contributor

sounds great! Thank you

Champion Level 3

@Al2 :



> Set MyTimer = Utils.Timers.Add(8000, "unit1.TimerRoutine", True)
> What's 'unit1' here.

Does it help?


  /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.
Showing results for 
Search instead for 
Did you mean: