You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After getting a child element inside Picture Manager, using the TreeWalker to walk the UIA tree is behaving erratically.
I am running Windows 10 Pro 10.0.19044, and Microsoft Office 2010 Picture Manager.
How to reproduce (using inspect.exe tool in UI Automation mode):
Open up an image in Picture Manager
Inspect the image element: Inspect tools' TreeWalker "Navigate to Previous sibling" and "Navigate to Next sibling" buttons are unavailable
Inspect the toolbar under the image (where the Next and Previous buttons are): Inspect tools' next and previous sibling buttons are unavailable
Inspect the image element, click on TreeWalker "Parent" button, then click twice on either the "Navigate to First Child" button or the "Navigate to Last Child" button. Now the sibling buttons are available, and clicking through them gets both the image element and the toolbar element.
Note: using the inspect.exe tool is only a demonstration, the same issue exists using the framework directly.
Expected behaviour:
TreeWalking to previous and next sibling should be available right away.
After getting the parent element, getting the original element shouldn't take two steps.
I tried to create a reproducible sample with C#, but the code freezes altogether. Open up a new Notepad window, and Microsoft Office 2010 Picture Manager window, and open a random image. Using System, System.Windows.Automation, System.Runtime.InteropServices:
AutomationElement rootElement = AutomationElement.RootElement;
AutomationElement npEl = rootElement.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.NameProperty, "Untitled - Notepad"));
npEl.SetFocus();
Console.WriteLine("Found and activated Notepad");
AutomationElement documentEl = npEl.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Document));
Console.WriteLine("Document element name: " + documentEl.Current.Name);
AutomationElement pmEl = rootElement.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.NameProperty, "Microsoft Office 2010"));
pmEl.SetFocus();
Console.WriteLine("Found and activated window");
AutomationElement imageEl = pmEl.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Image));
Console.WriteLine("Image element name: " + imageEl.Current.Name);
Console.ReadLine();
This stops indefinitely at line 11.
The text was updated successfully, but these errors were encountered:
Original post at Q&A: https://docs.microsoft.com/en-us/answers/questions/929263/uiautomation-treewalker-misbehaving-in-microsoft-o.html
After getting a child element inside Picture Manager, using the TreeWalker to walk the UIA tree is behaving erratically.
I am running Windows 10 Pro 10.0.19044, and Microsoft Office 2010 Picture Manager.
How to reproduce (using inspect.exe tool in UI Automation mode):
Note: using the inspect.exe tool is only a demonstration, the same issue exists using the framework directly.
Expected behaviour:
I tried to create a reproducible sample with C#, but the code freezes altogether. Open up a new Notepad window, and Microsoft Office 2010 Picture Manager window, and open a random image. Using System, System.Windows.Automation, System.Runtime.InteropServices:
This stops indefinitely at line 11.
The text was updated successfully, but these errors were encountered: