【发布时间】: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