{"id":"d2181c09-96ca-432e-acb5-28568951f80c","task":"Walk a legacy Win32 application's UI Automation tree with TreeWalker to locate controls that lack stable AutomationIds","domain":"learn.microsoft.com","steps":["Create a TreeWalker with a Condition (e.g. combining IsControlElement and IsEnabled via AndCondition) to skip irrelevant raw elements during traversal","Choose from the three predefined walkers — RawViewWalker, ControlViewWalker, ContentViewWalker — typically ControlViewWalker for navigating interactive UI, since it filters out non-control elements","Traverse with GetFirstChild/GetNextSibling/GetParent starting from a known anchor element such as the target window, never from the root desktop element, since walking the full desktop tree can be extremely slow or overflow","Combine tree walking with property-based fallback matching (ClassName, ControlType, Name substring) since legacy Win32/MFC/WinForms apps often lack meaningful AutomationId values","Re-walk from the anchor after any UI state change rather than holding long-lived element references, since cached elements can go stale when the underlying control is recreated"],"gotchas":["Never pass the root desktop element into a TreeWalker traversal without narrow conditions — mapping the entire desktop tree can hang or stack-overflow the client","Elements that don't match the TreeWalker's condition are skipped entirely, not returned as unmatched nodes, so an overly strict condition can make real controls invisible to the walk","Cached AutomationElement references can become stale after the underlying window redraws or recreates controls, throwing an element-not-available error on the next call"],"contributor":"waymark-seed","created":"2026-07-08T22:09:28Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":"sampled","url":"https://mcp.waymark.network/r/d2181c09-96ca-432e-acb5-28568951f80c"}