UIAutomation AutomationElement 强制刷新 .current 和所有后代
我想刷新顶级 AutomationElement 对象(桌面元素)及其所有后代的树结构。
我遇到的问题是我正在测试的一个特定程序以一种奇怪的方式丢弃并重建其 GDI 对象,并且我知道自动化的某些部分将导致它重建其树结构。我没有明确使用 .cache,而是使用 .current 来访问自动化元素值。 我可以模仿 uispy 中的 GDI 结构更改,即使我在 uispy 中点击“刷新”,它也不足以获取新对象,关闭并再次启动 uispy 可以修复此问题。我想在我的程序中模仿关闭+重新打开 uispy 的行为,以强制重建任何需要重建的数据结构。
目前,我最终得到的自动化元素不再引用它们的“新”子元素,或者将 0,0,0,0 作为它们的边界矩形。
另外,有人可以准确地告诉我 uispy 'refresh' 命令以编程方式执行的操作吗?
I would like to refresh the tree structure of the top level automationelement object (the desktop element) and all of its descendants.
The problem I have ran into is a particular program I am testing discards and rebuilds its GDI objects in a strange manner, and I have certain sections of my automation that I know will cause it to rebuild its tree structure. I'm not explicitly using .cache, but rather .current to access the automation elements values.
I can mimic the GDI structure change in uispy and even if I hit 'refresh' in uispy its not good enough to fetch to new objects, closing and starting up uispy again fixes this though. I would like to mimic the behavior of closing+reopening uispy within my program to force a rebuild of whatever datastructures need to be rebuild.
Currently I end up with automationelements that no longer reference their 'new' children, or have 0,0,0,0 for their boundingrectangle among other things.
Also, could someone tell me exactly what the uispy 'refresh' command does programmatically?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论