Ask Your Question
1

What is the method to retrieve LegacyIAccessible information using UiAutomation?

asked 2022-12-25 11:00:00 +0000

david gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-10-31 08:00:00 +0000

plato gravatar image

To retrieve LegacyIAccessible information using UiAutomation, you can use the following steps:

  1. Create a UiAutomation object by calling the static method "UiAutomation.GetInstance()" on the UiAutomation class.
  2. Get the root element of the desktop by calling the "UiAutomation.RootElement" property on the UiAutomation object.
  3. Get the list of all child elements of the root element by calling the "FindAll(TreeScope.Children, Condition.TrueCondition)" method on the root element.
  4. Go through each child element in the list and check if it supports the "LegacyIAccessible" pattern by calling the "GetCurrentPattern(LegacyIAccessiblePattern.Pattern)" method on the element.
  5. If the element supports the "LegacyIAccessible" pattern, get the "LegacyIAccessible" object by casting the result of "GetCurrentPattern(LegacyIAccessiblePattern.Pattern)" to a "LegacyIAccessiblePattern" object.
  6. Retrieve the information about the element using the methods of the "LegacyIAccessiblePattern" object, such as "GetChildId", "GetName", and "GetRole".
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-12-25 11:00:00 +0000

Seen: 15 times

Last updated: Oct 31 '22