【问题标题】:Selenium C# InPrivate Mode Internet Explorer IE 11 throws exceptionSelenium C# InPrivate Mode Internet Explorer IE 11 抛出异常
【发布时间】:2017-08-01 09:19:47
【问题描述】:

我需要在 Winodws10 上以私有模式打开 IE11。通过以下代码尝试,但抛出异常“启动 Internet Explorer 时出现意外错误。无法使用 CreateProcess() API。要将 CreateProcess() 与 Internet Explorer 8 或更高版本一起使用,HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer 中的注册表设置值\Main\TabProcGrowth 必须为 '0'。"

代码: int val = Convert.ToInt32(Microsoft.Win32.Registry.GetValue("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\TabProcGrowth", "", -1));

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

RegEdit中有key,我可以读取成功。

【问题讨论】:

    标签: selenium selenium-webdriver internet-explorer-11 selenium-iedriver


    【解决方案1】:

    删除ops.ForceCreateProcessApi = true; 有助于启动浏览器,但不是在隐私模式下。你需要结合

    ops.ForceCreateProcessApi = true;
    ops.BrowserCommandLineArguments = "-private";
    

    【讨论】:

      【解决方案2】:

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

      ops.ForceCreateProcessApi = true;
      

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-08-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-12-22
        相关资源
        最近更新 更多