Microsoft Edge does not fire UIA HandlePropertyChangedEvent when window title property changes

Viewed 125

I'm trying to get notified when the Window title of an MS Edge browser window changes using UIAutomation but the property changed event is not firing as I would expect.

The code works for IE, Chrome and FireFox and the only noticeable difference I can see when inspecting the window using Accessibility Insights is that they implement the IUIAutomationLegacyIAccessiblePattern interface and MS Edge does not but as I can see the property changing I would still expect the event to fire.

Before I go looking for a work around e.g. using SetWindowHook to trigger the title change event I'm wondering if there is a small change I can make to get MS Edge working?

Here is a how I'm creating the handler

     IUIAutomationElement rootElement = _uIA.GetRootElement();

     IUIAutomationCacheRequest cacheRequest = _uIA.CreateCacheRequest();
     cacheRequest.AddProperty(UIA_NamePropertyId);

     IUIAutomationCondition windowCondition = _uIA.CreatePropertyCondition(UIA_NativeWindowHandlePropertyId, handle);
     IUIAutomationElement windowElement = rootElement.FindFirstBuildCache(TreeScope.TreeScope_Descendants, windowCondition, cacheRequest);
     if (windowElement == null)
          return false;                                                                          
                                                                                                 
     int[] props = { UIA_NamePropertyId };

     _uIA.AddPropertyChangedEventHandler(windowElement, TreeScope.TreeScope_Element, cacheRequest, this, props);

The code works fine for getting the window and I can see the title chaging on the windowElement.CacheName it just never fires the HandlePropertyChangedEvent.

To clarify I'm using a wrapper around uiautomationclient and not the .net automation framework

0 Answers
Related