Forum Discussion

apurvak's avatar
apurvak
Occasional Contributor
5 years ago
Solved

Unable to idetify message box using object spy

Hi, I am trying to identify a message box using object spy; but it is unable to identify the message box. Below mentioned are the methods which are not present due to which it is unable to identify the message box: ,System.Windows.Forms.MessageBoxOptions.ServiceNotification | System.Windows.Forms.MessageBoxOptions.DefaultDesktopOnly System.Windows.Forms.MessageBox.Show("Hi TestComplete...", "Test Complete", MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1 ,System.Windows.Forms.MessageBoxOptions.ServiceNotification | System.Windows.Forms.MessageBoxOptions.DefaultDesktopOnly); Also please find attached screenshots for the same.

  • apurvak:
    Hi,

     

    I think that you need to talk to developers and ask them how they open descendant window for the second application.

    On my machine, main application window becomes not responsive after the OK button is clicked and remains unresponsive until this spawned window is closed.
    (My guess, is that the window is opened within the .Click() button handler and thus the whole UI of the application is blocked until the child window is closed. If this is the case, consider the Runner.CallObjectMethodAsync() method described here: https://support.smartbear.com/testcomplete/docs/scripting/calling-methods-asynchrounously.html)

     

    [Update]:

    I decompiled both your applications using Telerik's Just Decompile and noted that:

    a) Message box is opened indeed from the button's click() event handler. So you definitely will need to click this button asynchronously as it was suggested above;

            private void Button_Click(object sender, RoutedEventArgs e)
            {
                MessageBox.Show("Hi TestComplete...", "Test Complete", MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification | MessageBoxOptions.DefaultDesktopOnly);
            }

     

    b) Message box in the WpfApplication_NotAbleToIdentify.exe is opened using additional MessageBoxOptions.ServiceNotification | MessageBoxOptions.DefaultDesktopOnly flags (see code above) introduced for later versions of Windows. You may read more about them for example here: https://stackoverflow.com/questions/14280640/service-with-the-servicenotification-option, https://docs.microsoft.com/en-gb/dotnet/api/system.windows.forms.messageboxoptions?view=netframework-4.8 and https://docs.microsoft.com/en-us/previous-versions/bb756986(v=msdn.10)?redirectedfrom=MSDN.

    Considering the above articles, I think that you need to talk with your developers and ask if these flags are really required? What will happen if no user is logged-in while the message is displayed? Won't this deadlock the application?

     

    In case these flags are required indeed, I think that you need to contact Support directly via this form (https://support.smartbear.com/message/?prod=TestComplete) and ask for their recommendations. The case is that according to what I read in the above articles and saw in TestComplete's Object Browser, the whole UI of your application is locked and invalidated while the message box window is present on the screen. (TestComplete's UI is also frosen if the Object Browser is opened.)

     

9 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Based upon the screenshots, it looks like the message is being served up inside some other component rather than as a message box by itself.  What does that larger container resolve as in Object Spy?

    • apurvak's avatar
      apurvak
      Occasional Contributor

      The class name of outer object is Infragistics.Windows.DockManager.DocumentContentHost and it can be easily identified.

      Regarding the message box it is apparing as a separate window and so it is not identified.

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        apurvak wrote:

        The class name of outer object is Infragistics.Windows.DockManager.DocumentContentHost and it can be easily identified.

        Regarding the message box it is apparing as a separate window and so it is not identified.


        So, the outer object is a content host.  My guess is that the error message is coming from whatever is doing the hosting.  This is why you can't spy the message box because it's not actually part of your application but being hosted in.   You're going to have to use some sort of OCR or image based identification to find and interact with the object.

  • anupamchampati's avatar
    anupamchampati
    Frequent Contributor

    It seems information window is been treated as another exe as we have seperate windows in the taskbar.

     

    Try to change settings in process filter to use all processes

     

    1. Open Current Project properties

    2. Select OpenApplication--->Process Filter

    3. Select use all processess from the dropdown.

     

    Hopefully this will solve your problem of object spy in information window.

     

    Please consider giving this a kudos if its helps to solve your problem.

    • apurvak's avatar
      apurvak
      Occasional Contributor

      Hi,

       

      Tried changing settings in process filter but still it is not working.