RPA.Dialogs and locators UI in VSCode not working

Symptoms

  • When using RPA.Dialogs the execution throws out errors referring to Microsoft.Toolkit.Forms.UI.Controls.WebView
    • If your robot uses pywebview library directly, you will see the same error.
  • When creating new locators in the VSCode extension, the Inspector UI does not open / throws an 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:

Both do the same thing; they set up the Microsoft Edge WebView2 on the system level.

August 23, 2022