在Windows Server 2012 R2上使用IEDriver时,我遇到了一些问题。在Windows 10上,ChromeDriver,IEDriver和GeckoDriver工作正常,但在Windows Server上只有ChromeDriver可以使用。
IEDriver返回OpenQA.Selenium.WebDriverException:启动Internet Explorer时出现意外错误。 IELaunchURL()返回HRESULT 80070012('没有更多文件。')
我添加了这些配置:
版本:
我目前使用的代码就是这个(C#):
InternetExplorerOptions options = new InternetExplorerOptions();
options.IgnoreZoomLevel = true;
options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
return ieDriver = new InternetExplorerDriver("Path To IEDriver", options);
有人可以帮我解决这个错误吗?
添加“options.EnsureCleanSession = true;”为我解决了这个问题:
InternetExplorerOptions options = new InternetExplorerOptions();
options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
options.EnableNativeEvents = false;
options.EnsureCleanSession = true;
来自我使用的来源的建议:Selenium WebDriver on IE11:
本地:
var options = new InternetExplorerOptions();
options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
//Clean the session before launching the browser
options.EnsureCleanSession = true;
远程:
capabilities = DesiredCapabilities.InternetExplorer();
capabilities.SetCapability("ie.ensureCleanSession", true);