Find Element Issue


  • I am trying to find a list item from a Windows Forms list using UI Automation. In some cases it fails and I don't understand why.

    Failed cases:

    • Searching with AutomationElement.FindFirst from the same application
    • Searching with TreeWalker.RawViewWalker from the same application

    Passed cases:

    • The above, but from a different, smaller test application
    • Inspect Objects tool

    With other WPF and Windows Forms controls I had no problem. Can you please help me understand what happens?

    Friday, November 15, 2013 4:49 PM


  • After some searching I found this post suggesting to use the native API. The managed API is not maintained any more and is outdated.

    Switching the UI Automation client to the native API solved my problem with finding elements.

    (Sorry for not including a link, MSDN does not allow me to post it).
    • Marked as answer by Radu Coman Thursday, December 12, 2013 4:49 PM
    Thursday, December 12, 2013 4:49 PM