Selenium C#Intrivate Mode Internet Explorer IE 11抛出异常



我需要在winodws10上打开私人模式的IE11。通过以下代码尝试,但它引发了异常"启动Internet Explorer的意外错误。无法使用createProcess()api。将createProcess()与Internet Explorer 8或更高版本一起使用,这是HKEY_CURRENT_USER SOFTWORE MICROSOFT Internet Explorer中注册表设置的值 main tabprocgrowth必须为'0'。"

代码: int val = convert.toint32(Microsoft.win32.Registrue.getValue(" hkey_current_user software software Microsoft Internet Explorer main main tabprocgrocgrocgrocgrowth",",-1));

>
            InternetExplorerOptions ops = new InternetExplorerOptions();
            ops.ForceCreateProcessApi = true;
            ops.BrowserCommandLineArguments = "-private";
            IWebDriver driver = new InternetExplorerDriver(url, ops);

regedit中有关键,我可以成功阅读。

删除 ops.ForceCreateProcessApi = true;有助于启动浏览器,但不能以私有模式启动。您需要

的组合
ops.ForceCreateProcessApi = true;
ops.BrowserCommandLineArguments = "-private";

我像你一样有问题。我搜索了很多,没有找到解决方案,直到我尝试删除以下行:

ops.ForceCreateProcessApi = true;

感谢上帝,问题得到了解决。我很想知道它是否帮助您解决了问题

最新更新