MicrosoftEdge / MicrosoftEdge/WebView2Feedback

Inconsistent reporting of UI Automation elements

Open
#3,530 3 comments 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

Description

Description
The WebView2 control is inconsistent in what UIA elements it reports. The first time its UIA elements are enumerated, only a partial set is returned. On subsequent enumerations, the full set is consistently returned. This occurs in Edge, in the WebView2 samples, and with a tiny test app that we created separately. This behavior does not occur in Chrome, so it seems unlikely that this is a Chromium bug.

Version
SDK: Unknown
Runtime: 113.0.1774.57 (as reported by Control Panel)
Framework: WinForms (also happens with WPF)
OS: Win11 22H2

Repro Steps

  1. Install the Axe.Windows CLI from https://github.com/microsoft/axe-windows/releases/tag/v2.1.2
  2. Build the WebView2WindowsFormsBrowser test app from https://github.com/MicrosoftEdge/WebView2Samples
  3. Run WebView2WindowsFormsBrowser.exe
  4. Open task manager to get the main process. This will be listed as WebView2WindowsFormsBrowser in the UI--in this screenshot, the processID we want is 9196
    image
  5. Run the Axe.Windows CLI tool and note how many errors are reported
  6. Run the Axe.Windows CLI tool again and note that the error count has changed
  7. You can run the Axe.Windows CLI tool additional times and note that the error count remains constant
  8. The error count should remain constant, but the first call doesn't enumerate the entire tree. This is demonstrable by opening the generated .a11ytest files in Accessibility Insight for Windows and comparing the reported hierarchies. As demonstrated below, the contents of the Document control are completely absent from the first test.

Screenshots

Iteration Command line (exe is on path) Errors reported
1 AxeWindowsCLI.exe --outputdirectory %userprofile%\desktop --scanid 1 --processid 9196 23
2 AxeWindowsCLI.exe --outputdirectory %userprofile%\desktop --scanid 2 --processid 9196 195
3 AxeWindowsCLI.exe --outputdirectory %userprofile%\desktop --scanid 3 --processid 9196 195

Comparisons of 1st iteration and 2nd iteration in Accessibility Insights for Windows. The selected element is identical in each, but the first set of results omit the Document control containing the HTML.

Call # Returned UIA hierarchy
1 image
2 image

Additional context

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.