webdrivermanager.net-更新Chrome驱动程序会自动失败
我在更新Chromedriver(使用WebDriverManager )方面遇到问题。 尝试以下代码:
private static WebDriver getChromeDriver()
{
ChromeOptions options = new ChromeOptions();
options.AddUserProfilePreference("profile.default_content_setting_values.images", 2);
options.AddArguments("headless", "--blink-settings=imagesEnabled=false");
options.AddArguments("--disable-extensions"); // to disable extension
options.AddArguments("--disable-notifications"); // to disable notification
options.AddArguments("--disable-application-cache"); // to disable cache
new DriverManager().SetUpDriver(new ChromeConfig(), VersionResolveStrategy.MatchingBrowser);
try
{
return new ChromeDriver(options);
}
catch (Exception e)
{
MessageBox.Show("Error loading Chrome. Need to update driver?");
throw;
}
}
代码返回异常。 据我了解,new DriverManager()。设置Updriver(new ChromeConfig(),versionResolvestrategy.MatchingBrowser);
应该照顾驱动程序版本吗?
我对这个项目的经验不够。 它使用硒自动登录到网站,但我想先检查和更新Chrome驱动程序。
I am having problems with updating chromedriver (using WebDriverManager
).
Trying with below code:
private static WebDriver getChromeDriver()
{
ChromeOptions options = new ChromeOptions();
options.AddUserProfilePreference("profile.default_content_setting_values.images", 2);
options.AddArguments("headless", "--blink-settings=imagesEnabled=false");
options.AddArguments("--disable-extensions"); // to disable extension
options.AddArguments("--disable-notifications"); // to disable notification
options.AddArguments("--disable-application-cache"); // to disable cache
new DriverManager().SetUpDriver(new ChromeConfig(), VersionResolveStrategy.MatchingBrowser);
try
{
return new ChromeDriver(options);
}
catch (Exception e)
{
MessageBox.Show("Error loading Chrome. Need to update driver?");
throw;
}
}
Code returns Exception.
As far as i understand new DriverManager().SetUpDriver(new ChromeConfig(), VersionResolveStrategy.MatchingBrowser);
should take care of driver version?.
I am not experienced enough with this project.
It uses Selenium to automatically log in to a website, but i would like to check and update chrome drivers first.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Chrome和Edge都有WebDrivermanager.net的问题。长话短说,WebDriverManager用于下载更新驱动程序的URL已更改,但是Nuget软件包尚未更新以使用新的URL。
问题已在GitHub上打开以解决以下问题:
在编写此答案时,由于Google和Microsoft已更改了用于下载包含Web驱动程序可执行文件的ZIP文件的URL,因此似乎断开了WebDrivermanager.net的自动更新功能。
There are issues with WebDriverManager.Net for both Chrome and Edge. Long story short, 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.
Issues have been opened on GitHub to address this:
As of writing this answer, it appears the auto-update feature of WebDriverManager.Net is broken because Google and Microsoft have changed the URLs used to download the zip files containing web driver executables.