Forum Discussion

bphillips's avatar
bphillips
New Contributor
13 years ago

Unable to recognize multiple instances of WPF windows in process lifetime

We are using TestComplete v9.3 to automate testing of a WPF application. We have been able to successfully test a lot of the application with TestComplete but there is one major issue that we have not been able to resolve. Within the application we display popups/windows when a button is clicked, the user can enter data into the pupup/window and then the data is passed back to the main window. We have been able to automate this task with TestComplete but we can only get it to work once before we have to restart the application if we need to access the same popup/window. 



When looking at the NameMapping, i can see that TestComplete has automatically used RootVisual.ClrClassName and WndCaption to distinguish the different popups/windows within our application. The first time a popup/window is launched I am able to highlight the popup/window from NameMapping - Mapped Objects. However, when I "submit" data (click OK) on the popup/window and re-launch the same popup/window I am not able to highlight the object again and I receive a warning that the object is not visible.



I have noticed that on the first launch the new window has a Name in the Object Browser of WPFObject("HwndSource: ConfirmationInteractionWindow", "Add Miscellaneous") and the next time the window is opened it has a name of WPFObject("HwndSource: ConfirmationInteractionWindow", "Add Miscellaneous", 1). Is this an issue or can/should TestComplete handle this? I have tried editing the Mapped Objects to include both of these names but that did not work (see Attachment 1). 



This issue is limiting our testing efforts so any help would be appreciated. Please let me know if there are any additional details that I need to provide.



Thanks!

4 Replies

  • AlexKaras's avatar
    AlexKaras
    Community Hero
    Hi Ben,



    Have you tried to remove Name property from the NameMapping at all and identify the problematic window by its ClrClassName and WndCaption properties (or some other property(ies) that guarantee unique and stable identification) ?
  • bphillips's avatar
    bphillips
    New Contributor
    I have tried calling the RefreshMappingInfo() (using the Call Object Method test action) on the main window and the "Add Miscellaneous" window after the OK button is clicked. I have also tried calling the RefreshMappingInfo() on the "Add Miscellaneous" window after it is displayed for the second time. None of these worked for me though.

  • bphillips's avatar
    bphillips
    New Contributor
    I was able to add the "VisibleOnScreen" property to my windows/popups and run "RefreshMappingInfo" on the window/popup once it is visible and it has worked consistently.



    Thanks for the help!