Page 1 of 1

Recommended way to identify windows dialogs

Posted: Mon Aug 16, 2010 2:51 pm
by grid
Hi everyone,

We are trying to build proper UI-Testrepositories for our application at the moment. Since the application supports multiple frontend languages, we do not want to match captions and window titles to identify objects in the repositories.

Has anyone found a good way to identify a Windows Dialog such as OpenFileDialog for building a repository without matching it via Caption? NativeWindow Class is always "#32770", no matter if it is an OpenFileDialog or a MessageBox.

I am using Ranorex Professional, Version 2.3.3 on Windows7, forms are created using WPF.

Thanks for any suggestions,
Marcel

Re: Recommended way to identify windows dialogs

Posted: Mon Aug 16, 2010 4:04 pm
by Ciege
If you are trying to find a window that has no unique identifiers besides the index number and caption but want to be able to support multiple languages you will have to do some extra coding yourself.

Possibilities are:
1) Create a strings file that you reference with the different language conversions for each possible window.
2) Write some extra code that searches objects within a window to determine what type of window it is (such as does it have a file entry edit box or not, if so it's probably a OpenFileDialog window).
3) Use a RegEx expression to look for windows with captions like XXX or YYY.

You will have to get a little creative to work this problem since the uniqueness of the window is the caption and that is the one thing that changes with each different language. Fortunately with your own code you can have your developers crate specific object IDs, but when you start automating other peoples code (such as Windows dialogs) you are at the mercy of however they did it.

Re: Recommended way to identify windows dialogs

Posted: Mon Aug 16, 2010 4:55 pm
by grid
Hi Ciege,

Thanks for the answer.
Ciege wrote: 2) Write some extra code that searches objects within a window to determine what type of window it is (such as does it have a file entry edit box or not, if so it's probably a OpenFileDialog window).
I feared, something like this would be suggested. So this would mean that I would search for this OpenFileDialog at test runtime rather than "save it" to the repository?

Re: Recommended way to identify windows dialogs

Posted: Mon Aug 16, 2010 5:03 pm
by Ciege
Well, I do not use the repository. All my automation searches are done at runtime. Not necessarily the best way to do it, but it is the way I do it... That being said, writing more code to make a better determination of what the window type is is not a bad thing to me...

However, if you want to stick with the repository and not have to write a lot more code you can try adding all the different instances of different languages to your repository item(s). That way a match would occur regardless of language tested against. This would require more upfront setup time on your part to determine the proper recognition strings and language differences for each unnamed form and those to your repository.

Re: Recommended way to identify windows dialogs

Posted: Fri Aug 20, 2010 1:20 pm
by atom
Hiya

Class #32770 is the standard windows dialog class
See : http://msdn.microsoft.com/en-us/library ... 85%29.aspx

We have used that nice trick before to search for all top level windows with that class name to check for any dialogs...

Cheers