cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to idetify message box using object spy

SOLVED
Highlighted
Occasional Contributor

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: Unable to idetify message box using object spy

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

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

View solution in original post

9 REPLIES 9
Highlighted
Community Hero

Re: Unable to idetify message box using object spy

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?


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Highlighted
Occasional Contributor

Re: Unable to idetify message box using object spy

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.

Highlighted
Frequent Contributor

Re: Unable to idetify message box using object spy

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.

Highlighted
Occasional Contributor

Re: Unable to idetify message box using object spy

Hi,

 

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

Highlighted
Community Hero

Re: Unable to idetify message box using object spy


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


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Highlighted
Community Manager

Re: Unable to idetify message box using object spy

Thanks everybody for the help!

 

@apurvak, have you found the solution? Please share it with us.

 

 

 

---------
Tanya Gorbunova
SmartBear Community Manager

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
Highlighted
Occasional Contributor

Re: Unable to idetify message box using object spy

Hi,

 

I am still not able to identify the object.

 

I am sharing two sample applications where in one application messagebox can be identied by Test complete and in another application messagebox cannot be identified.

 

Attached are the sample applications which are developed by our development team.

 

Highlighted
Community Hero

Re: Unable to idetify message box using object spy

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

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

View solution in original post

Highlighted
Community Manager

Re: Unable to idetify message box using object spy

Thanks for the update, Alex.

@apurvak, does this reply help?

 

 

---------
Tanya Gorbunova
SmartBear Community Manager

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
New Here?
Join us and watch the welcome video:
Announcements
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges and get into the Leaderboard!

Challenge Status

How to execute remote test and obtain results via Test Runner REST API

Participate!

Comparing content of HTML table with Excel file data

Participate!

Compare HTML table with Excel file and correct data in the file

Participate!

Retrieve Data from a Web Page

Participate!