yinkaisheng / Python-UIAutomation-for-Windows

🐍Python 3 wrapper of Microsoft UIAutomation. Support UIAutomation for MFC, WindowsForm, WPF, Modern UI(Metro UI), Qt, IE, Firefox, Chrome ...
Apache License 2.0
2.3k stars 462 forks source link

foundIndex倒序查找问题 #235

Open Kaguya233qwq opened 1 year ago

Kaguya233qwq commented 1 year ago

需要查找的对象是一个由TextControl组成的消息队列,现在我需要获取的是最新的一条消息,而它又排在索引的最后一位,亦也无法确定一共有多少条消息。foundIndex貌似不支持输入负数。请问应该如何精准定位位于索引最后一位的控件?

qq463505965 commented 1 year ago

这个我觉得可以自己写算法。比如在获得最新的一条消息后,重新定位TextControl组成的消息队列的父元素 message_control = TextControl().GetParentControl().refind() #TextControl() 得是你定位到的消息队列里面的随便一个 message_control.GetChildren()[-1] #这样就定位到了最新一个消息框