Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/327.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Selenium webdriver NUnit C-如何禁用在安全模式下打开firefox?_C#_Firefox_Selenium_Webdriver - Fatal编程技术网

C# Selenium webdriver NUnit C-如何禁用在安全模式下打开firefox?

C# Selenium webdriver NUnit C-如何禁用在安全模式下打开firefox?,c#,firefox,selenium,webdriver,C#,Firefox,Selenium,Webdriver,隐式测试是在Firefox安全模式下运行的,我需要禁用它。我一直在寻找这样做的方法,但我找不到任何方法 FirefoxProfile profile = new FirefoxProfile(); profile.SetPreference("toolkit.startup.max_resumed_crashes", "-1"); IWebDriver driver = new FirefoxDriver(profile); 配置文件未被识别,就好像它未被声明一样。这是我的密码: namesp

隐式测试是在Firefox安全模式下运行的,我需要禁用它。我一直在寻找这样做的方法,但我找不到任何方法

FirefoxProfile profile = new FirefoxProfile();
profile.SetPreference("toolkit.startup.max_resumed_crashes", "-1");
IWebDriver driver = new FirefoxDriver(profile);
配置文件未被识别,就好像它未被声明一样。这是我的密码:

namespace Test
{
    public class Class1
    {
        FirefoxProfile profile = new FirefoxProfile();
        profile.SetPreference("toolkit.startup.max_resumed_crashes", "-1");
        IWebDriver driver = new FirefoxDriver(profile);
    }
}
配置文件的错误为:

'Test.Class1.profile是一个字段,但与'type'一样使用


与硒无关,而是一个基本的C问题

您没有入口点,例如Main方法。如果这是一个DLL,例如要与NUnit或MSTest一起使用的库,则需要使用属性来定义测试,例如TestFixture