Forum Discussion

Bingo's avatar
Bingo
Contributor
5 years ago

TC report an error " Unexpected window: '' " for one normal subobject.

     Like the pic, it report an error for unexpected window, but it don't trigger my events llike last unexpected window,

And the unpxected point to "

Sys.Process("Inventor").WPFObject("HwndSource: MiniFrameBorder", "", 1)

" that belongs to my tested app. But If last waring unexpected window don't appear, the error unexpected window won't appear.

So my question how to handle the second error unexpected window?

And it's my events:

 

Sub GeneralEvents_OnUnexpectedWindow(Sender, Window, LogParams)


Call Log.Picture(Window, "Screen image", "This image was added to TestLog from the GeneralEvents_OnUnexpectedWindow procedure")
Log.Warning "Unexpected Window",, pmNormal
If Window.WndClass = "#32770" Then
If Window.waitWindow("Button","&Yes",,5000).Exists Then Window.waitWindow("Button","&Yes",,5000).Click
If Window.waitWindow("Button","&OK",,5000).Exists Then Window.waitWindow("Button","&OK",,5000).Click


End If

End Sub

 

  • Hi,

     

    While it is good to know that you've solved the problem, I would pay attention to the 'The action may be performed incorrectly...' warning and improve test code to handle this properly.

     

    As a note: OnUnexpectedWindow event is triggered when test code tries to activate some window but fails to do this because the window cannot be activated (i.e. put in front of user) due to be overlapped by another application- or system-modal window.

     

  • Bingo's avatar
    Bingo
    Contributor

    " If Window.WndClass = "#32770" Then " was commented and should be deleted.

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    While it is good to know that you've solved the problem, I would pay attention to the 'The action may be performed incorrectly...' warning and improve test code to handle this properly.

     

    As a note: OnUnexpectedWindow event is triggered when test code tries to activate some window but fails to do this because the window cannot be activated (i.e. put in front of user) due to be overlapped by another application- or system-modal window.

     

    • Bingo's avatar
      Bingo
      Contributor

      Thanks, the issue still exists in my project. But for your information, I know how to trigger the unexpected window. Maybe tested App has conflict with Testcomplete. I will work on it to solve.