Forum Discussion

jazeckel's avatar
jazeckel
Occasional Contributor
19 hours ago

TestComplete not recognizing WPF objects in interopped WPF window

I have an application that I am testing that uses both Delphi VCL and WPF, connected together via a Windows Forms interop layer.  The WPF portion is using .NET 10.  Initially, TestComplete was not able to see anything inside the Windows Forms wrapper at all, and was only showing it to me in the object browser with a name like "Window("WindowsForms10.Window.8.app.[some numbers]", "", 1)", with a subitem of "Window("HwndWrapper[DefaultDomain;;[some numbers]", "", 1)".

I was able to get past that by adding "HwndWrapper*" to the list of accepted windows in the project properties for Open Applications -> UI Automation.  This now shows all of the WPF items as UIAObjects.  However, I would really like to have all of the TestComplete WPFObject wrappers.  Is there another setting/configuration I need to do somewhere to be able to do that?

Again just for clarity, the main application is a Delphi VCL win32 application.  That application is hosting a Windows Forms control in part of its display (the Windows Forms control is COM visible and loaded in via COM into a TGenericOleCtrl in Delphi VCL).  The Windows Forms window is then hosting WPF controls (via ElementHost).

3 Replies

  • rraghvani's avatar
    rraghvani
    Icon for Champion Level 3 rankChampion Level 3

    Use "*" for UI Automation and MSAA, to see what is exposed to TestComplete. 

     

    • jazeckel's avatar
      jazeckel
      Occasional Contributor

      Checking the star there doesn't seem to do anything different.  I can access the objects, but they all show as UIAObject instead of WPFObject, so, for example, if I have a WPF ComboBox, I only get the standard UIAObject wrapper methods to use on it (e.g. Click) instead of the WPF ComboBox wrapper methods (e.g. ClickItem).

      • rraghvani's avatar
        rraghvani
        Icon for Champion Level 3 rankChampion Level 3

        My understanding is that TestComplete loses the ability to inject its WPF hooks properly. At that point, it falls back to Microsoft UI Automation. I don't think it can expose WPFObject when WPF is hosted via ElementHost and the host is embedded in a non-dotNet container. It's like WPF is effectively "sandboxed" from TestComplete’s WPF plugin.