3

I do automation for WPF application using UIAutomation API. Everything went fine until I hit the Ribbon control. I have no trouble to see information about Ribbon and its children through the Inspect.exe, but inside the code I cannot obtain the information about those elements.

It other words, in this code aeElement is always null:

aeElement = aeForm.FindFirst(TreeScope.Children,
                  new PropertyCondition(AutomationElement.NameProperty, "XXX"));

I tried TreeScope.Descendants and TreeScope.Elements. I tried AutomationElement.ControlTypeProperty and AutomationElement.AutomationIdProperty. I tried TreeWalker – nothing worked.

Wondering if there is a solution for that issue? Thank you very much in advance.

EDIT: There is no answer at http://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/home?forum=windowsaccessibilityandautomation either.

Lola
  • 63
  • 5

1 Answers1

1

your worst case scenario is the root, correct? then try the following solution:

a. search from the root and then go deeper into the window, context, and so goes on

b. if a didn't work, then it must be your spelling. the name is case sensitive.

c. why aren't you using AutomationID? it was created for that use!

shirbr510
  • 819
  • 1
  • 11
  • 19
  • no, root is not a problem at all; no spelling errors for sure; and as i mentioned in my question i tried AutomationId property as well - not working either – Lola Jan 19 '14 at 01:38
  • so when you search from root you don't have the problem? if so, search deeper. it might be in a parallel scope to the window it self – shirbr510 Jan 22 '14 at 19:53