查找具有Name属性的部分匹配的自动化元素 [英] Finding an automation element with a partial match for the Name property

查看:134
本文介绍了查找具有Name属性的部分匹配的自动化元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过Name属性的部分匹配找到自动化元素?例如,如果我知道自动化元素的name属性将始终包含"foo",那么以及其他一些文本,如何通过搜索"foo"来找到自动化元素?

Is it possible to find an automation element through a partial match of the Name property? For example, if I know that the automation element's name property will always contain "foo" along with some other text, how do I find that automation element by just searching for "foo"?

推荐答案

我对此有点新意,但我认为我已经看到了一些用于实现自己的树步行器的示例,实际上您需要实现递归树步行并通过您自己的比较过滤掉您想要的节点。如果你这样做,我可能会建议使用Regex作为你的搜索模式,这是Regex的一小部分工作,但功率和灵活性都有很大的提升。

HTH,

动物园

I kind of new to this, however i think i've seen a few examples for implementing you own tree walker, effectively you will need to implement recursive tree walking and filter out the nodes you want via your own comparison.   I might recommend if you do this use Regex for your search pattern,  a very small amount of work for the Regex, but huge gains in power and flexibility.

HTH,

Zoo


这篇关于查找具有Name属性的部分匹配的自动化元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆