UIAutomation AutomationElement force refresh .current and all descendants

4.2k views Asked by At

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?

0

There are 0 answers