-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
[🐛 Bug]: EdgeDriver downloaded in wrong version when using WebView2 #12958
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@ssrmm, thank you for creating this issue. We will troubleshoot it as soon as we can. Info for maintainersTriage this issue by using labels.
If information is missing, add a helpful comment and then
If the issue is a question, add the
If the issue is valid but there is no time to troubleshoot it, consider adding the
If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C),
add the applicable
After troubleshooting the issue, please add the Thank you! |
I would say WebView2 is a use case apart. I recommend you download the correct browser driver that matches your app binary. I do not think Selenium Manager needs to handle this. What do you think @titusfortner @bonigarcia? |
What happens if you specify the binary location in the options class? Selenium Manager now does not fail on the name, should get the version at the specified location (I think) and then download the driver you need. |
I've been looking into the support for WebView2. Indeed, it seems the implementation of #12904, as requested in #12738, is incorrect. The best way to support WebView2 would be to introduce a separate module from Edge, in which the browser name is The effort to support everything in Selenium Manager is low, so I am up to implementing this for the next release. |
I agree that it makes sense that you need to specify the binary location yourself if you have the WebView2 binaries bundled together with your application (aka Fixed Version runtime distribution mode). However in this scenario WebView2 is installed in a well-known location on the system where it lives independent of the application under test (aka. Evergreen Runtime distribution mode). There I think it would make sense to centralize the logic of determining the version of WebView2 in a place like Selenium Manager. As a matter of fact we use exactly this information from the registry to determine the
You mean like this? var options = new EdgeOptions
{
DebuggerAddress = "localhost:12345",
UseWebView = true,
BinaryLocation = @"C:\Program Files (x86)\Microsoft\EdgeWebView\Application\118.0.2088.46\msedgewebview2.exe"
};
using var driver = new EdgeDriver(options); This produces the same error as before, Under the hood Selenium Manager seems to ignore the argument in this scenario:
Though this wouldn't really help, even if it did work: Getting the path to the executable is equivalent to getting the version because the path depends on the version and both need to be read from the registry. |
But it's getting the right driver version... The change I just made will prevent the bindings from overwriting the browser path with an empty string in the options getting sent to the driver. I *think the next version should be good enough without Boni needing to do more work here. |
It's getting 113.x even though it should get 118.x |
Just realized that this sentence may have been ambiguous. I was referring to the stacktrace from the initial message in this issue, i.e.
|
Right, right I wasn't looking closely enough. Your edge is 113, and your webview is 118. |
Since this is an actual case where the version numbers are coincidence, the laws of physics obviously require that the two numbers must be ones that are the hardest to distinguish 😆
I guess that would work nicely for people that use the above mentioned Fixed Version runtime distribution mode where the WebView2 binaries are just somewhere next to the application. They presumably know that location anyway because it is either in a fixed location period or at the very least in a fixed location relative to the application under test. With this hypothetical change, if WebView2 is installed system-wide in Evergreen Runtime distribution mode one would still need to get the binary location from the registry somewhere in the test setup code. Which is equivalent to the current situation where one needs to get the version from the registry. That or hardcoding the version, either by hardcoding it directly or by hardcoding it as part of the binary location. The convenience win for the Evergreen Runtime case would be that Selenium finds the installed WebView2 without having to specify neither path nor version (both of which change). |
I created a PR to fix the support for WebView2 in Selenium Manager. @ssrmm Can you please have a try? Please download and extract the new Selenium Manager binary (from here: selenium-manager_windows-x32) and run the following command with it:
|
Looks like this is working:
I've also replaced the Selenium Manager binary in the build-folder of the the test code. With the replaced binary the tests now run without having to specify anything with an otherwise 4.14.1 Selenium NuGet package 👍 |
I guess this can be closed. At this point we have even upgraded to the latest release that contains these changes and that is working as well. Thanks! |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
What happened?
When Selenium Manager determines the version of the EdgeDriver to download for use with the WebView2 runtime, it looks for the version of the installed Edge Browser. This however is not correct when the versions of Edge and the WebView2 runtime differ. Instead the the version of the WebView runtime should be detected and used to determine the driver-version to download.
On the machine in question the following version of Edge and the WebView2 runtime are currently installed:

In this scenario the following code does not work:
It produces this error:
As a workaround you currently need to specify at least the major Version explicitly (note the
BrowserVersion
property at the end):Invoking Selenium Manager directly yields the following output:
When specifying the version explicitly, this changes to:
At least on Windows Microsoft recommends to read the version of the installed WebView2 runtime from the registry. The registry value
pv
exists under one of the following keys and will contain the version information:HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}
(system-wide installation)HKEY_CURRENT_USER\Software\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}
(per-user installation)I don't know what the right approach on other operating systems would be.
How can we reproduce the issue?
Relevant log output
Operating System
Windows 10, Windows 11
Selenium version
.NET 4.14.1
What are the browser(s) and version(s) where you see this issue?
Edge WebView2 118
What are the browser driver(s) and version(s) where you see this issue?
EdgeDriver 118
Are you using Selenium Grid?
No
The text was updated successfully, but these errors were encountered: