User condition for UIA

Is there a way to write my own System.Windows.Automation.Condition class? I do not know how this class works, because it does not offer a public method for defining comparison behavior.

Reference Information. I use the UIAutomation library to find elements that the user interacts with to repeat their actions. Sometimes it’s hard for me to access an element by its properties, such as an automation identifier or name. I recently found out that the buttons in the Aero Windows 7 panel change the names to the name of the selected instance, and it really amazes me because I can no longer use the exact name for comparison.

+4
source share
1 answer

You can use inspect.exeto view all available properties of any user interface element on the screen. This will help you understand what properties you want to use to identify the user interface element in various cases. For example: I found that a property is AutomationIdvery useful in some cases where the element name is not static.

Also, if you want to find an element with a partial coincidence of the name Name, you can iterate the entire tree (for example: through a method FindAll) of the available element with TrueConditionand check the name coincidence manually.

0
source

All Articles