Microsoft

Handling playback failures in Coded UI Test due to stale UI controls

Mar 4, 2012Tapas Sahoo [MSFT]
Handling playback failures in Coded UI Test due to stale UI controls
SummaryAI, from the source post

This post addresses playback failures in Coded UI Test caused by stale UI controls, specifically when interacting with controls within popup windows like dialog boxes or context menus. It explains that the error 'FailedToPerformActionOnBlockedControlException' often stems from a stale accessible object persisting after an earlier instance of the same window was not disposed of properly. The post provides three workarounds: 1. Using the `VisibleOnly` search configuration for the target control and its ancestors. 2. Combining `VisibleOnly` with `AlwaysSearch` (with caution due to performance impact). 3. Using the `OrderOfInvocation` property for the top-level window to disambiguate duplicate windows. It also suggests using `DrawHighlight()` for visual verification and provides a method to collect all matching windows to verify the desktop session state.

More from the Coded UI Test Deprecation and Alternatives trail