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 t...
  • AlexKaras's avatar
    AlexKaras
    5 years ago

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