在Win32Tree上查找子级时,System.Windows.Automation的FindFirst()和FindAll()调用出现性能问题.是否有任何方法可以优化这些调用. [英] Performance issue on FindFirst() and FindAll() calls of System.Windows.Automation ,while finding the child from on Win32Tree .Is there any way to optimize the calls.?
问题描述
我们正在使用System.Windows.Automation中的某些功能以及TestStack/White. We are using some feature from System.Windows.Automation with TestStack/White . 我正在使用以下代码来获取树节点 I am using the below code to fetch the tree node 此代码需要花费更多时间来获取节点.由于节点是从应用程序动态创建的,因此我们需要反复调用此代码(重试)以获取更新的值. This code taking more time to fetch the node .Since the node is created dynamically from application we need to call this code again and again(re-try) to get updated value. 我们正在使用System.Windows.Automation中的某些功能以及TestStack/White. We are using some feature from System.Windows.Automation with TestStack/White . 我正在使用以下代码来获取树节点 I am using the below code to fetch the tree node 此代码需要花费更多时间来获取节点.由于节点是从应用程序动态创建的,因此我们需要反复调用此代码(重试)以获取更新的值. This code taking more time to fetch the node .Since the node is created dynamically from application we need to call this code again and again(re-try) to get updated value. 这篇关于在Win32Tree上查找子级时,System.Windows.Automation的FindFirst()和FindAll()调用出现性能问题.是否有任何方法可以优化这些调用.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
在FindFirst()调用中,我们面临以下性能问题.
We are facing below performance issue on FindFirst() call.
AutomationElement parentNode = win32TreeNode.AutomationElement.GetUpdatedCache(CacheRequest.Current); AutomationElement childNode = null;
childNode = parentNode.FindFirst(TreeScope.Children,new PropertyCondition(AutomationElement.NameProperty,childNodeId));
AutomationElement parentNode = win32TreeNode.AutomationElement.GetUpdatedCache(CacheRequest.Current);AutomationElement childNode = null;
childNode = parentNode.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.NameProperty, childNodeId));
有什么建议可以加快这个过程.
另外,如果我们需要第二次获取更新的值,是否需要再次调用FindFirst()?或者还有其他方法可以获取更新的节点吗?
Is there any suggestion to speed up this process.
Also if we need to get the updated value second time whether we need to call FindFirst() again ?Or is there any other way we can get the updated node?
Please provide sample snippet if possible.推荐答案
在FindFirst()调用中,我们面临以下性能问题.
We are facing below performance issue on FindFirst() call.
AutomationElement parentNode = win32TreeNode.AutomationElement.GetUpdatedCache(CacheRequest.Current); AutomationElement childNode = null;
childNode = parentNode.FindFirst(TreeScope.Children,new PropertyCondition(AutomationElement.NameProperty,childNodeId));
AutomationElement parentNode = win32TreeNode.AutomationElement.GetUpdatedCache(CacheRequest.Current);AutomationElement childNode = null;
childNode = parentNode.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.NameProperty, childNodeId));
有什么建议可以加快这个过程.
另外,如果我们需要第二次获取更新的值,是否需要再次调用FindFirst()?或者还有其他方法可以获取更新的节点吗?
请提供示例代码.
Is there any suggestion to speed up this process.
Also if we need to get the updated value second time whether we need to call FindFirst() again ?Or is there any other way we can get the updated node?
Please provide sample snippet if possible.