browser.download.manager.showWhenStarting可能不会被覆盖 [英] browser.download.manager.showWhenStarting may not be overridden

查看:1052
本文介绍了browser.download.manager.showWhenStarting可能不会被覆盖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用selenium webdriver for firefox的C#项目。在我用NuGet包管理器安装最新的webdriver(2.40)之后,发生这个错误:

I'm using selenium webdriver for firefox on C# project. After I installed the latest webdriver (2.40) with NuGet Package manager this error occurred:


'Class'的类型初始化程序抛出异常。 --->
System.ArgumentException:Preference
browser.download.manager.showWhenStarting不能重写:
冻结值= False,请求值= False。

The type initializer for 'Class' threw an exception. ---> System.ArgumentException: Preference browser.download.manager.showWhenStarting may not be overridden: frozen value=False, requested value=False.

我的代码:

FirefoxProfile profile = new FirefoxProfile();
profile.SetPreference("browser.download.manager.showWhenStarting", false);
webdriver = new FirefoxDriver(profile);

第二行出现错误。
你知道如何解决这个问题吗?

The error is raised on the second line. Do you have any idea how this can be solved?

推荐答案

.NET绑定最近更新,其他语言绑定的行为,使用预设的配置文件设置列表,如果期望 FirefoxDriver 正常工作,其中一些不可更改。您尝试设置的偏好设置是这些冻结设置之一。它应该已经具有您尝试设置它的值。如果没有,驱动程序中可能会有一个错误。

The .NET bindings were recently updated to match the behavior of other language bindings, using a preset list of profile settings, some of which are not changeable if one expects the FirefoxDriver to work properly. The preference you're attempting to set is one of those "frozen" settings. It should already have the value you're attempting to set it to. If it doesn't, there may be a bug in the driver.

您可以验证设置是否已经是您想要的,但查看异常详细信息:

You can verify that the setting is already what you desire, but looking at the exception details:

示例:

profile.SetPreference("network.http.phishy-userpass-length", 255);

会抛出错误:


System.ArgumentException:首选项network.http.phishy-userpass-length不能重写:frozen value = 255 ,请求值= 255

意味着冻结值已经是正确的, SetPreference()

Meaning the frozen value would already be correct, and that SetPreference() can be removed.

这篇关于browser.download.manager.showWhenStarting可能不会被覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆