Forum Discussion

bommareddy's avatar
bommareddy
Contributor
8 years ago
Solved

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
    bommareddy
    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.

     

    OnStartTest:

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

    OnStopTest:

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

    unit1.TimerRoutine:

    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

     

    Regards,

    BommaReddy