Locators UI in VSCode not working
Symptoms
When creating new locators in the VSCode extension, the Inspector UI does not open / throws an error referring to Microsoft.Toolkit.Forms.UI.Controls.WebView
- If your robot uses
pywebview
library directly, you will see the same error.
Reason
Many frameworks and libraries that do UI interactions are built on WebView2. WebView2 is essentially built into the new browsers for Windows and macOS.
- On Windows, if you have the new Edge browser installed, WebView2 should be available.
- On Mac, you get this with Safari.
- On Linux,
pywebview
and most implementations leverage the Qt libraries to get a similar capability.
As on Windows, no browsers are forced; it is possible to have a system that does not have WebView2 installed. This is especially common on Windows Server setups, unfortunately.
Solution
This problem is pretty much limited to Windows environments, so the solution here is only for Windows.
You need to install one of the two below:
- The WebView2 Evergreen Standalone Installer
- The latest Microsoft Edge browser
Both do the same thing; they set up the Microsoft Edge WebView2 on the system level.
Last edit: August 23, 2022