Pywinauto如何获取返回元素的列表 [英] Pywinauto how do I get the list of returned elements
问题描述
我正在使用具有自定义堆栈面板的WPF应用程序,该面板基本上是一个列表.列表中的项目完全相同,因此我无法选择特定文本来唯一标识元素.时间等其他一些值是动态的.
有没有办法让我获取返回的元素列表.我知道这是可能的,因为抛出了错误,ElementAmbiguousError声明了计数.
如果我可以这样做,那么我可以从该列表中使用索引并验证我需要的内容.
您可以将found_index=0
或其他索引添加到窗口规范对象.这是消除搜索歧义的第一种方法.
也有方法.children()
和.descendants()
带有其他参数,例如control_type
或title
(我记得title
应该可以工作),但是这些方法不支持某些窗口规范参数.>
I'm using a WPF application that has custom stack panel, which is basically a list. The item in the list is exactly the same so I'm not able to select a specific text to uniquely identify the elements. And some other values such as time are dynamic.
Is there a way for me to get the list of elements returned. I know it's possible because the error was thrown, ElementAmbiguousError state the count.
If I could do that, then from that list I can use the index and validate what I need.
You can add found_index=0
or other index to the window specification object. This is the first way to disambiguate the search.
Also there are methods .children()
and .descendants()
with additional params like control_type
or title
(as I remember title
should work), but some window specification params are not supported in these methods.
这篇关于Pywinauto如何获取返回元素的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!