Forum Discussion

bommareddy's avatar
8 years ago

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...
  • bommareddy's avatar
    8 years ago

    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