Posted 30 May 2012
Link to this post
I am currently programming an automation tool using the new native Microsoft UI
Automation API 3.0 (using VC++ 2010, native C++, Win7). The Application
Under Test (AUT) is a WPF application containing some Telerik controls
(particularly RadDocking, RadSplitContainer, RadGroup, RadPane).
UIA works fine - I can install event handlers, navigate through the tree,
search elements using various conditions and control the found elements
using their patterns.
However recently I encountered a behaviour that leaves me baffled: The UIA tree of
my AUT simply is not up-to-date after switching the central RadPane's
After switching the RadPane's content, I can *see* the new controls in the
AUT's GUI but the UIA tree still reflects the controls that have been there
before. The (outdated) UIA sub-tree can be still completely read using UIA
search functions or using a UIA walker but of course it can not be written
since the underlying controls do not exist anymore.
I was not able to force an update of the the UIA sub-tree; neither by
calling any UIA functions nor by restarting the tester application or by
switching the RadPane's content back and forth.
The issue happens only if my tester application does access the
RadPane's UIA sub-tree before it is switched. I.e. the system seems to
memorize the RadPane's UIA sub-tree and keeps the old elements even after
switching the RadPane's content.
This exactly looks like there would be an outdated cache... however I do NOT
use any caching UIA functions at all. None. Never. Nowhere.
Currently I found only one mysterious, cumbersome way to update the RadPane's
UIA sub-tree reliably: Using one of the Microsoft tools "Inspect" or
"UISpy"! E.g. when using the Inspect tool having a brief look into RadPane's
UIA sub-tree (by click-expanding the corresponding node in the tree), the
problem is suddenly gone and my tester application can access the actual,
RadPane's up-to-date UIA sub-tree immediately! Of course this is a temporary
I have no idea what Inspect/UISpy is doing to update the UIA tree of an
Inspect.exe uses the same native interface as I do but UISpy.exe uses the
.NET interface AFAIK so this seems not to depend from the used Microsoft
API. BTW, the tool "Snoop" does not have this effect.
I really need help. Currently I am unable to locate the origin of the
problem. On the one hand this problem happens with Rad controls (and their
content) only, on the other hand the Microsoft tools seem to do the trick
somehow. So I suppose there is some detail I have to know when automating
Rad controls via UIA.
Does anyone have an idea how to approach the problem?
Thanks in advance,