Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/306.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.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
Selenium C#InPrivate模式Internet Explorer_C#_Selenium_Internet Explorer 11_Incognito Mode - Fatal编程技术网

Selenium C#InPrivate模式Internet Explorer

Selenium C#InPrivate模式Internet Explorer,c#,selenium,internet-explorer-11,incognito-mode,C#,Selenium,Internet Explorer 11,Incognito Mode,在使用Selenium C#运行自动测试时,我试图在InPrivate模式下启动IE11。找到了做这件事的选项,但我似乎不能让我的工作与这些代码行 InternetExplorerOptions options = new InternetExplorerOptions(); options.ForceCreateProcessApi = true; options.BrowserCommandLineArguments = "-private";

在使用Selenium C#运行自动测试时,我试图在InPrivate模式下启动IE11。找到了做这件事的选项,但我似乎不能让我的工作与这些代码行

        InternetExplorerOptions options = new InternetExplorerOptions();
        options.ForceCreateProcessApi = true;
        options.BrowserCommandLineArguments = "-private";

        IWebDriver driver = new InternetExplorerDriver(options);
        return driver;
驱动程序打开时,我可以在任务管理器上看到它,但是IE没有打开。如果我删除了InternetExplorerDriver中的选项,它就完全可以正常工作了。所以期权有问题。你知道这件事吗


谢谢

这是一个很老的话题,但万一有人还需要它。。。我偶然发现了一个类似的问题

检查您是否正在使用32位IE驱动程序。我艰难地发现
options.ForceCreateProcessApi=true
将导致此驱动程序超时,至少对于我测试过的版本(3.4.0-3.8.0)。到目前为止,我还没有设法让私有模式在这种设置下工作32位

目前,我将此作为一种解决方法:

options.EnsureCleanSession = true;

这会大大降低测试速度,但至少会清除缓存。

这是一个很老的话题,但万一有人还需要它。。。我偶然发现了一个类似的问题

检查您是否正在使用32位IE驱动程序。我艰难地发现
options.ForceCreateProcessApi=true
将导致此驱动程序超时,至少对于我测试过的版本(3.4.0-3.8.0)。到目前为止,我还没有设法让私有模式在这种设置下工作32位

目前,我将此作为一种解决方法:

options.EnsureCleanSession = true;

这会大大降低测试速度,但至少会清除缓存。

我无法理解“如果我删除了InternetExplorerDriver中的选项,它会完全正常工作。”。你想删除什么?我是说如果我只做新的InternetExplorerDriver();而不是新的InternetExplorerDriver(选项);选项部分导致断开连接,但无法找到问题,因为它看起来很正常。您的代码是否抛出任何错误?请尝试此设置功能(InternetExplorerDriver.IE_SWITCHES,“-private”)@mosaad,我想你是在建议使用Java代码。这在C上不起作用,我无法理解“如果我删除InternetExplorerDriver中的选项,它就完全可以工作。”。你想删除什么?我是说如果我只做新的InternetExplorerDriver();而不是新的InternetExplorerDriver(选项);选项部分导致断开连接,但无法找到问题,因为它看起来很正常。您的代码是否抛出任何错误?请尝试此设置功能(InternetExplorerDriver.IE_SWITCHES,“-private”)@mosaad,我想你是在建议使用Java代码。它在C上不是这样工作的#