Lola
Lola

Reputation: 63

UI Automation and Ribbon control

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.

Upvotes: 3

Views: 1025

Answers (1)

shirbr510
shirbr510

Reputation: 858

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!

Upvotes: 1

Related Questions