locked
"FindMatchingControls" method returned an empty collection when invoked on the topwindow of a WPF application RRS feed

  • Question

  • Hi All,

             When i am calling "FindMatchingControls()" API on Topwindow control of WPF application even when more than one instance of the application is present,the API is returning an empty collection.

            This Problem is seen only on the WPF Controls.

    We have checked with MSAA controls,the API is working as expected.

    Any help in this regard is greatly appreciated.

    Regards,

    Rajender.

                  

      

             

    Thursday, May 23, 2013 12:43 PM

Answers

  • Hello,

    Thank you for your post.

    If possible, you can provide us your code about how to locate the topwindow control of WPF app using FindMatchingControls() method so that we can further look at this issue.

    FindMatchingControls Method returns a collection of all UITestControls that match the specified SearchProperties and FilterProperties. You need to define some searchproperties to locate the target controls before you use FindMatchingControls() method.

    And I suggest that you try to perform actions on TopWindows control of WPF app using Coded UI Test Builder in a coded UI test. And then you run the test to check if expected controls are found. If yes, you can check the generated code in UIMap.Designer.cs and see what properties have been used to locate the control and then compare with your code. And you can refer to the generated code in your own code.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Amanda Zhu Wednesday, May 29, 2013 9:17 AM
    Friday, May 24, 2013 6:48 AM

All replies

  • Hello,

    Thank you for your post.

    If possible, you can provide us your code about how to locate the topwindow control of WPF app using FindMatchingControls() method so that we can further look at this issue.

    FindMatchingControls Method returns a collection of all UITestControls that match the specified SearchProperties and FilterProperties. You need to define some searchproperties to locate the target controls before you use FindMatchingControls() method.

    And I suggest that you try to perform actions on TopWindows control of WPF app using Coded UI Test Builder in a coded UI test. And then you run the test to check if expected controls are found. If yes, you can check the generated code in UIMap.Designer.cs and see what properties have been used to locate the control and then compare with your code. And you can refer to the generated code in your own code.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Amanda Zhu Wednesday, May 29, 2013 9:17 AM
    Friday, May 24, 2013 6:48 AM
  • Hello,

    Since we haven't heard from you for some time, I temporarily close this case. I mark useful reply as answer. If you have any concerns, please feel free to unmark it to reopen it or submit a new question.

    Thanks for your understanding.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, May 29, 2013 9:17 AM
  • Hi Amanda,

    Here the problem is not seen while checking the Exists property in the assertion window which is seen after dragging the cross hair.

    In the code we are trying to get the matching controls for the mainwindow. If a collection is returned we get the required instance from the collection based on our logic.

    We are seeing few issues while getting the matching controls on the parent window:  

    WpfWindow mainWindow = this.UIDataGridWindowWindow;
    bool windowExistence = mainWindow.Exists;
    UITestControlCollection coll = mainWindow.FindMatchingControls();

    Following is the exception seen while executing the FindMatchingControls method on WPF mainwindow:

    A QueryInterface call was made requesting the class interface of COM visible managed class 'MS.Internal.AutomationProxies.NonClientArea'. However since this class derives from non COM visible class 'MS.Internal.AutomationProxies.ProxyHwnd', the QueryInterface call will fail. This is done to prevent the non COM visible base class from being constrained by the COM versioning rules.

    -----

    Any help here is greatly appreciated.

    Regards,

    Sirisha


    sirisha

    Thursday, May 30, 2013 5:28 AM