WebDriverManager.Net icon indicating copy to clipboard operation
WebDriverManager.Net copied to clipboard

Edgedriver returns a 404 error

Open lauvers opened this issue 3 years ago • 9 comments

2022-02-14_15-56-10

Since this weekend (02/12) we get an error when trying to initiate a driver for MSEdge: System.Net.WebException: The remote server returned an error: (404) Not Found.

What does this mean?

Edge browser version: 98.0.1108.50 Selenium version: 4.1.0 WebDriverManager version: 2.12.3

        public IWebDriver GetEdgeDriver()
        {
            _driverManager.SetUpDriver(new EdgeConfig());
            EdgeOptions options = new EdgeOptions
            {
                AcceptInsecureCertificates = true,
            };
            var edgeDriver = new EdgeDriver(options);
            edgeDriver.Manage().Window.Maximize();
            return edgeDriver;
        }

We did not change anything about our UITest setup. The driver for Chrome (also using WebDriverManager) works just fine.

lauvers avatar Feb 14 '22 15:02 lauvers

I got the same issue for MS Edge Chromium. Based on my investigation, I found out the following:

MSEdgeDriver has different releases for different platforms (Windows, MacOS, Linux). The LATEST_STABLE from WebDriverManager/DriverConfigs/Impl/EdgeConfig.cs#L12 returns the maximal released number and ignores Platform.

For example, currently, the LATEST_STABLE returns 98.0.1108.51. But this version exists for MacOS only (see https://msedgedriver.azureedge.net/): image And need to use 98.0.1108.50 for Windows.

Looks like, need to use LATEST_RELEASE_98_WINDOWS for Windows instead of LATEST_STABLE:

image

@rosolko , Could you, please, change logic of getting latest msedgedriver version based on Platform?

lastas avatar Feb 14 '22 16:02 lastas

Is this issue permanent? Or it's just temporary version miss-sync? If temporary just use custom driver implementation. If permanent - fix needed. As for now I have not a lot of free time, so I can't guarantee fast fix, so better to prepate pull request if fix really needed fast.

rosolko avatar Feb 14 '22 16:02 rosolko

For temporary solution we can try this also. You can match the browser version and download the drivers. new DriverManager().SetUpDriver(new EdgeConfig(), VersionResolveStrategy.MatchingBrowser);

vthipps avatar Feb 15 '22 09:02 vthipps

For temporary solution we can try this also. You can match the browser version and download the drivers. new DriverManager().SetUpDriver(new EdgeConfig(), VersionResolveStrategy.MatchingBrowser);

This seems to work for us, thanks!

I thought this only worked for Chrome...

lauvers avatar Feb 15 '22 09:02 lauvers

But it's weird. When I try this url : https://msedgedriver.azureedge.net/LATEST_STABLE, in the browser directly it works just fine and downloads the driver. I'm not getting a 404 there.

DBCOOPER90 avatar Feb 15 '22 16:02 DBCOOPER90

@DBCOOPER90 By this url you download a file with single line which contains latest version of webdriver. Webdriver itself downloading by url (windows example) - https://msedgedriver.azureedge.net/<version_from_previous_file>/edgedriver_win32.zip

rosolko avatar Feb 15 '22 18:02 rosolko

@rosolko, yes that's what I want, to download the latest driver and that's what is failing. The source code indicates that is the Url it uses to get the latest driver. I have a full generic framework for qa automation and in it, I have a driver library that heavily relies on this nuget package since I don't wanna be constantly updating my framework and updating all the projects that uses it.

I used to just do this :

var path = new WebDriverManager.DriverManager().SetUpDriver(new WebDriverManager.DriverConfigs.Impl.EdgeConfig());

then the path would be used to create a very specific edge service setup. Now in the mean time, I've decided to put this temporary patch until the main issue is fixed :

image

DBCOOPER90 avatar Feb 16 '22 13:02 DBCOOPER90

The URL to download the zip file has changed. Plus, the default version matching strategy fails if Microsoft does not release a version of web driver for each operating system.

Reading https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ tells me that the major version numbers for EdgeDriver must match the major version numbers for Microsoft Edge. Same basic pattern as ChromeDriver and Chrome.

The URL to get the "latest" version number (https://msedgedriver.azureedge.net/LATEST_STABLE) returns something. It is returning 103.0.1264.51 for me today. I'm on Windows 10 x64. According to the edge driver page, versions 104 and 105 are available, but for some reason the "LATEST_STABLE" is 103 for me.

This is tricky to solve. VersionResolveStrategy.Latest really means "latest version available for the current OS, CPU architecture and major version of the browser".

Basically, you need the operating system, CPU architecture, and major version of Microsoft Edge in order to determine the latest version. You must download the ~2MB XML file at https://msedgedriver.azureedge.net/ and parse through it to identify the "latest" version.

gburghardt avatar Jul 12 '22 20:07 gburghardt

A good thread to read related to this topic: https://github.com/MicrosoftEdge/EdgeWebDriver/issues/39

gburghardt avatar Jul 13 '22 13:07 gburghardt