Tag not monitored by Microsoft.
Flutter Web’s canvas-based rendering means the DOM is not a faithful representation of the UI, so any tool that relies on DOM structure or standard selectors will be fundamentally limited. The only reliable automation surface in this scenario is the accessibility/automation layer that the browser and WebView2 expose.
Key points and options based on the available information:
- WebView2 and UI Automation
- On Windows, WebView2 content is exposed through Microsoft UI Automation (UIA) when the browser (Edge/WebView2) has accessibility enabled. Assistive technologies and automated test scripts can then interact with the UI via the UIA tree rather than the DOM.
- Microsoft Edge’s accessibility system maps HTML and ARIA to UIA objects. When Flutter exposes ARIA attributes (as in the current workaround), those are projected into the UIA tree, which can then be consumed by automation tools.
- Automated test scripts can use the Microsoft UI Automation framework to locate and interact with elements by their accessible properties (Name, ControlType, etc.), instead of DOM selectors.
This suggests a shift from DOM-based automation to UIA-based automation for WebView2-hosted Flutter Web content.
- Tools that can use the UIA/accessibility layer
Several tools in the Microsoft ecosystem can help inspect and automate via accessibility rather than DOM:
- Accessibility Insights for Windows
- Can inspect UI Automation elements, properties, control patterns, and events for Windows apps, including WebView2 content when exposed via Edge’s accessibility pipeline.
- Use it to verify which Flutter elements actually surface as accessible objects (including popups, menus, overlays) and what properties they expose.
- Microsoft UI Automation API
- Provides programmatic access to most UI elements on the desktop and is explicitly designed for both assistive technologies and automated test scripts.
- For dynamic elements (popups, submenus, overlays), use UIA to:
- Listen for UIA events (e.g., structure changed, menu opened) to detect when new elements appear.
- Query the UIA tree from the WebView2 root to find children by Name, ControlType, or other accessible properties.
If the Flutter app does not expose certain popups or overlays to the accessibility layer at all, no automation tool that depends on UIA or ARIA will be able to interact with them reliably.
- When frameworks don’t fully support UI Automation
If the framework or rendering approach does not implement UI Automation for some parts of the UI, options are limited:
- Some frameworks simply do not surface all UI elements to UIA. In such cases, system-provided tools like Narrator or Magnifier (and any UIA-based automation) cannot see those elements.
- Possible workarounds in such situations are:
- Relying on third-party accessibility tools that might use different techniques.
- Incorporating a UI Automation provider library into the app.
- Updating to a framework version that has better accessibility support.
- Porting to a framework that natively supports UI Automation.
In this scenario, without the ability to modify the Flutter app, these options are mostly under the control of the app’s developers, not the automation team.
- DevTools protocol, Playwright, Puppeteer, WinAppDriver
From the available information:
- Playwright
- Can automate and test webpages in a WebView2 control, but still relies on what the browser exposes (DOM and accessibility). For a canvas-heavy Flutter app, Playwright will face the same DOM limitations unless it can leverage the accessibility tree.
- WebDriver / DevTools
- Microsoft Edge WebDriver can attach to a running WebView2 instance and automate the web content, but again, this is primarily DOM-centric. For native UI around the WebView2, tools like WinAppDriver or UIA can be used.
- WinAppDriver
- Useful for automating the native Windows shell around WebView2 (buttons, dialogs, etc.), not the canvas-rendered Flutter content inside the WebView2, unless that content is exposed via UIA.
Given the canvas-based rendering, switching to Playwright, Puppeteer, or WebDriver alone will not solve the fundamental issue of missing DOM elements. The decisive factor is how much of the Flutter UI is exposed via ARIA/UIA.
- Practical guidance for the described problems
Within the constraints described:
- Use Accessibility Insights for Windows to:
- Inspect the WebView2 content and confirm which elements (including popups and submenus) appear in the UIA tree.
- Identify accessible names, roles, and patterns that can be used as selectors in UIA-based automation.
- Use the Microsoft UI Automation API (or a UIA-based test framework) to:
- Listen for UIA events when menus or overlays open.
- Traverse the UIA tree to locate dynamic elements by accessible properties rather than DOM selectors.
- If specific popups or overlays never appear in the accessibility tree, then:
- Those elements are effectively not automatable via supported Microsoft accessibility/automation mechanisms.
- The only durable fix is for the Flutter app to improve its accessibility implementation (e.g., exposing those elements with proper ARIA roles/names so Edge can map them into UIA).
Without changes to the Flutter app’s accessibility, there is no fully reliable, general-purpose way—via WebView2, Playwright, Puppeteer, or WinAppDriver—to automate all dynamic elements rendered purely on a canvas.
References:
- Testing for accessibility
- Accessibility in Microsoft Edge
- ARIA and UI automation in Microsoft Edge
- Resources about building accessible websites
- Win32: Some Frameworks do not support UI Automation
- Accessibility testing
- Automate and test WebView2 apps with Microsoft Edge WebDriver
- Use Playwright to automate and test in WebView2