Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 700
Lola Avatar asked Feb 03 '26 20:02

Lola


1 Answers

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!

like image 152
shirbr510 Avatar answered Feb 05 '26 08:02

shirbr510



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!