Hello,
We have been working with the MS UIA framework and noticed what appears to be a significant slowdown when finding collections of objects in Windows 10 / .NET 4.6.
When testing AutomationElement.FindAll() on a Windows 10 / .NET 4.6 box our times on average are roughly 3 to 5 times longer to find collections of elements than when finding the exact same elements on a Windows 8.1 / .NET 4.5.1 box.
My test is against a WPF DataGrid with virtualization on (using Recycling) and getting all of the cells inside each row of the DataGrid. On our Win10 box each FindAll call to get the cells in each row takes roughly 30 - 50ms or even longer. On the Win8.1 box it takes around 5 - 10ms. I am unable to figure out why, but I do not think the issue is limited to the DataGrid since there is nothing fancy about our FindAll() call.
//get grid AutomationElement gridElement = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "dataGridAutomationId")); //get all visible rows AutomationElementCollection dataItems = gridElement.FindAll(TreeScope.Descendants, new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.DataItem)); PropertyCondition condition = new PropertyCondition(AutomationElement.ClassNameProperty, "DataGridCell"); foreach (AutomationElement dataItem in dataItems) { if (!string.IsNullOrEmpty(dataItem.Current.Name)) { //call under test AutomationElementCollection cells = dataItem.FindAll(TreeScope.Children, new PropertyCondition(AutomationElement.ClassNameProperty, "DataGridCell")); } }
The use of AutomationElement.RootElement is for the test only. The 'dataItem.FindAll()' call is what I am testing.
Win 8.1 and Win10 machine specs:
- Xeon W3670 3.20GHz cpu
- 12gb ram
- 64bit OS
We have tried using the unmanaged API via com wrapping and saw no noticeable performance improvements on Win10.
If this question should be on another forum or somewhere else or more information is needed please let me know.
Thank you,
Jordan