SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
30.71k stars 8.19k forks source link

OpenQA.Selenium.WebDriverException : Unexpected error launching Internet Explorer. IELaunchURL() returned HRESULT 80070012 ('There are no more files.') #4135

Closed ygeelen-tb closed 6 years ago

ygeelen-tb commented 7 years ago

Error: OpenQA.Selenium.WebDriverException : Unexpected error launching Internet Explorer. IELaunchURL() returned HRESULT 80070012 ('There are no more files.') for URL 'http://localhost:1287/' TearDown : System.NullReferenceException : Object reference not set to an instance of an object.

Stack Trace: at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse) at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities) at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities) at OpenQA.Selenium.IE.InternetExplorerDriver..ctor(InternetExplorerDriverService service, InternetExplorerOptions options) at MercedesTestAutomation.AuthenticationSteps.GivenIAmOnTheAuthenticationpage() in C:\agent_work\120\s\MercedesTestAutomation\Steps\AuthenticationSteps.cs:line 34 at lambda_method(Closure , IContextManager ) at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStepMatch(BindingMatch match, Object[] arguments) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStep(IContextManager contextManager, StepInstance stepInstance) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnAfterLastStep() at TechTalk.SpecFlow.TestRunner.CollectScenarioErrors() at MercedesTestAutomation.Features.AfterSalesCommissionFlowFeature.ScenarioCleanup() at MercedesTestAutomation.Features.AfterSalesCommissionFlowFeature.AfterSalesCommissionFlow(String username, String password, String loginpassword, String[] exampleTags) in C:\agent_work\120\s\MercedesTestAutomation\Features\AfterSalesCommissionFlow.feature:line 21 --TearDown at lambda_method(Closure , IContextManager ) at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.InvokeHook(IBindingInvoker invoker, IHookBinding hookBinding, HookType hookType) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireEvents(HookType hookType) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireScenarioEvents(HookType bindingEvent) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnScenarioEnd() at TechTalk.SpecFlow.TestRunner.OnScenarioEnd() at MercedesTestAutomation.Features.AfterSalesCommissionFlowFeature.ScenarioTearDown()

OS: Windows Server 2012 R2 Standard Selenium Version: 3.4.0 IDE: Visual Studio 2017 Browser: Internet Explorer 11

NuGet packages versions:

<package id="AutoItX.Dotnet" version="3.3.14.2" targetFramework="net452" />
  <package id="Dapper" version="1.50.2" targetFramework="net452" />
  <package id="Newtonsoft.Json" version="10.0.2" targetFramework="net452" />
  <package id="NUnit" version="3.7.1" targetFramework="net452" />
  <package id="NUnit.Console" version="3.6.1" targetFramework="net452" />
  <package id="NUnit.ConsoleRunner" version="3.6.1" targetFramework="net452" />
  <package id="NUnit.Extension.NUnitProjectLoader" version="3.5.0" targetFramework="net452" />
  <package id="NUnit.Extension.NUnitV2Driver" version="3.6.0" targetFramework="net452" />
  <package id="NUnit.Extension.NUnitV2ResultWriter" version="3.5.0" targetFramework="net452" />
  <package id="NUnit.Extension.TeamCityEventListener" version="1.0.2" targetFramework="net452" />
  <package id="NUnit.Extension.VSProjectLoader" version="3.5.0" targetFramework="net452" />
  <package id="nunit.framework" version="2.63.0" targetFramework="net452" />
  <package id="NUnit.Runners" version="3.6.1" targetFramework="net452" />
  <package id="NUnit3TestAdapter" version="3.8.0-alpha1" targetFramework="net452" />
  <package id="NUnitTestAdapter" version="2.1.1" targetFramework="net452" />
  <package id="NUnitTestAdapter.WithFramework" version="2.0.0" targetFramework="net452" />
  <package id="Selenium.InternetExplorer.WebDriver" version="3.4" targetFramework="net452" />
  <package id="Selenium.Support" version="3.4.0" targetFramework="net452" />
  <package id="Selenium.WebDriver" version="3.4.0" targetFramework="net452" />
  <package id="SharpZipLib" version="0.86.0" targetFramework="net452" />
  <package id="SpecFlow" version="2.2.0-preview20170523" targetFramework="net452" />
  <package id="SpecFlow.NUnit" version="2.2.0-preview20170523" targetFramework="net452" />
  <package id="WebDriver.ChromeDriver" version="26.14.313457.1" targetFramework="net452" />
ygeelen-tb commented 7 years ago

@lukeis @p0deje Please advise

ygeelen-tb commented 7 years ago

@lukeis @p0deje Any idea what the cause could be? Actually we need to get this working by the 16th..

p0deje commented 7 years ago

Please provide concise reproducible test case so that we could act on this issue.

See CONTRIBUTING.md

ygeelen-tb commented 7 years ago

Attached:

Unfortunately I can't share the project's source code because of an NDA with our customer. But it uses the NuGet Packages listed above and can't run any test on VSTS because it can't launch the IE browser from VSTS (only from Visual Studio).

Customer-Test-CI.json.txt

Customer-CI.json.txt

jimevans commented 7 years ago

The IELaunchURL() function is a Windows API. The driver simply calls it. If it's returning an error, then that's where the issue is. There is no documentation provided by Microsoft about what would cause this error when using this API. If you attempt to run the test on a workstation-class OS like Windows 10, instead of on Windows Server, what happens? I realize that's not a "silver-bullet" solution, but there may be security settings at play in the server environment that are not in the workstation environment that would prevent additional file handles from being allocated in that context.

sthatip commented 7 years ago

I got this error too on Windows 10, IE11 v11.0.42, IEDriverServer.exe 32 bit, 3.4.0 bindings, with both C#/VS2017 and Java/Spring/Maven setup, although Spring sometimes reports the error as bean issue. When I execute the packaged jar on 2008 Server R2 with IE v11.0.43, I did not have the issue. Also, not an issue if I launch IE with standalone server and RemoteWebDriver(URL,Capabilities). Then I have other issues which may not be related to this topic.

sthatip commented 7 years ago

this resolved the issue for me, even though my zoom settings were always 100% and Protected Mode enabled in all zones.

DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer(); capabilities.setCapability(InternetExplorerDriver.IGNORE_ZOOM_SETTING, true); capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true); driver = new InternetExplorerDriver(capabilities);

ygeelen-tb commented 7 years ago

@jimevans I tried avoiding the use of IELaunchURL by using the option ForceCreateProcessApi without success: Message: OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://localhost:9448/session timed out after 60 seconds. ----> System.Net.WebException : The request was aborted: The operation has timed out.

On a Windows 10 machine I wasn't even able to deploy the Test Agent. My configuration is now as follows:

InternetExplorerOptions options = new InternetExplorerOptions(); options.BrowserAttachTimeout = TimeSpan.FromMinutes(3); options.ForceCreateProcessApi = true; options.EnsureCleanSession = true; options.BrowserCommandLineArguments = "-private"; options.IntroduceInstabilityByIgnoringProtectedModeSettings = true; options.IgnoreZoomLevel = true; options.InitialBrowserUrl = "about:blank"; return new InternetExplorerDriver(options);

barancev commented 6 years ago

This is a generic system error. See [1] and [2] for recommendations. Also upgrade Selenium and IEDriverServer to the latest version (3.13 at the moment).

[1] https://answers.microsoft.com/en-us/windows/forum/windows_7-files/there-are-no-more-files-error-whenever-i-try-to/73df3ecf-f02b-4b9e-aa3e-86a4c7604241 [2] https://windowsreport.com/there-are-no-more-files/