简体   繁体   English

WebDriverManager - '远程服务器返回错误:(404)未找到。'

[英]WebDriverManager - 'The remote server returned an error: (404) Not Found.'

I am using the Selenium WebDriverManager nuget package to manage driver versions.我正在使用 Selenium WebDriverManager nuget 包来管理驱动程序版本。 When I try to get the edge driver:当我尝试获取边缘驱动程序时:

var driverManager = new DriverManager();
driverManager.SetUpDriver(new EdgeConfig());

It fails with:它失败了:

System.Net.WebException: 'The remote server returned an error: (404) Not Found.'

I've tried updating my nuget packages which didn't help.我试过更新我的 nuget 包,但没有帮助。 I also found a related but unanswered question about Chrome driver - System.Net.WebException : The remote server returned an error: (404) Not Found我还发现了一个有关 Chrome 驱动程序的相关但未回答的问题 - System.Net.WebException:远程服务器返回错误:(404)未找到

Any idea what is causing this error and how to fix it?知道是什么导致了这个错误以及如何解决它吗?

To summarize, the URLs that WebDriverManager uses to download an updated driver have changed, but the NuGet package has not been updated to use the new URLs ( more info )总而言之,WebDriverManager 用于下载更新驱动程序的 URL 已更改,但 NuGet 包尚未更新为使用新 URL(更多信息


Original: So I am having the same issue, if you break your code and step into it at driverManager.SetUpDriver(new EdgeConfig());原文:所以我有同样的问题,如果你打破你的代码并在 driverManager.SetUpDriver(new EdgeConfig());

and view the details you'll see the URL it's using and trying to go to is here https://msedgedriver.azureedge.net/103.0.1264.51/edgedriver_win64.zip which doesnt exist (in checking my own up to date edge driver it is .49, so .51 doesnt exist because the updates didnt get that high yet.并查看详细信息,您将看到它正在使用并尝试访问的 URL 在这里https://msedgedriver.azureedge.net/103.0.1264.51/edgedriver_win64.zip不存在(在检查我自己的最新边缘驱动程序时)是 0.49,所以 .51 不存在,因为更新还没有那么高。

That version exists for MAC and Linux, but not Windows.该版本适用于 MAC 和 Linux,但不适用于 Windows。 For a fix I think you can set the type to be Windows only or something so it stops picking up a version that doesnt exist for Windows.对于修复,我认为您可以将类型设置为仅 Windows 或其他类型,以便它停止获取 Windows 不存在的版本。 This fix is in theory as I haven't tried it yet.这个修复是理论上的,因为我还没有尝试过。 Hope it helps.希望能帮助到你。

Nicole妮可

Editing this to give an update: I tried this and there's no way to set the OS and it is recognizing the OS since the URL extension is win64...I think this is a bug with webdriver manager that needs to be resolved on their end because it's recognizing the OS properly and even if you manually set it in code to grab latest it tries to grab the latest which was only released to Linux and Macs (seems like they need to include a filter to find latest and match on OS, not sure where to report this though to get it fixed).编辑这个以提供更新:我试过这个,没有办法设置操作系统,它正在识别操作系统,因为 URL 扩展名是 win64 ......我认为这是 webdriver 管理器的一个错误,需要最终解决因为它可以正确识别操作系统,即使您在代码中手动设置它以获取最新版本,它也会尝试获取仅发布到 Linux 和 Mac 的最新版本(似乎他们需要包含一个过滤器来查找最新版本并在操作系统上匹配,而不是确定在哪里报告此问题以修复它)。 If you manually set the version to "100.0.1154.0" which is the latest for win64 then it works again.如果您手动将版本设置为“100.0.1154.0”,这是 win64 的最新版本,那么它会再次起作用。 You can see all the releases at their website ( https://msedgedriver.azureedge.net ), but like I said its a but where latest or default is looking at date only and not filtering by the OS so when they drop a new one and its not for all the OS's then it breaks (this is my assumption, having trouble finding it in their source code which I dont think is available via VS when you install the package).您可以在他们的网站 ( https://msedgedriver.azureedge.net ) 上查看所有版本,但就像我说的那样,它是最新的或默认的只是查看日期而不是由操作系统过滤,所以当他们删除一个新版本时并且它不适用于所有操作系统,然后它会中断(这是我的假设,在他们的源代码中找不到它,我认为在安装软件包时无法通过 VS 获得它)。

If anyone finds anything please chime in!如果有人发现任何东西,请插话! Would love to know if there was a workable solution to filter ourselves until it's fixed.很想知道是否有一个可行的解决方案来过滤自己,直到它被修复。

这个解决方案对我有用,我只需要将VersionResolveStrategy.MatchingBrowser参数添加到驱动程序的初始化中,然后它就可以从服务器上找到并下载匹配的版本:

new DriverManager().SetUpDriver(new EdgeConfig(), VersionResolveStrategy.MatchingBrowser);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 HttpWebRequest引发“ 404远程服务器返回错误:(404)未找到。” - HttpWebRequest throws “The remote server returned an error: (404) Not Found.” for 404 远程服务器返回错误:(404)找不到。 在GetResponse()中 - The remote server returned an error: (404) Not Found. In GetResponse() Picasa API返回“远程服务器返回错误:(404)Not Found。” - Picasa API returns “The remote server returned an error: (404) Not Found.” 远程服务器返回错误 (404) 未找到。 在 system.net.httpwebrequest.getresponse() - the remote server returned an error (404) not found. at system.net.httpwebrequest.getresponse() 远程服务器返回错误:(404)找不到。 使用Facebook图形API时 - The remote server returned an error: (404) Not Found. when using facebook graph api 远程服务器返回错误:(404) 未找到。 谷歌在 C# 中的实现 - The remote server returned an error: (404) Not Found. google implentation in c# 远程服务器返回错误:(404)找不到-HttpWebResponse - The remote server returned an error: (404) Not Found - HttpWebResponse BrowserMob 代理 - 远程服务器返回错误:(404) 未找到 - BrowserMob Proxy - The remote server returned an error: (404) Not Found 服务器返回错误:找不到404 - The server returned an error: 404 not found 远程服务器返回一个错误:(404) Not Found error for API calls after server publish - The remote server returned an error: (404) Not Found error for API calls after server publish
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM