我正在使用运行firefox 41.0.2的firefox webdriver
Nunit 3.4.1
硒2.47.0
规格流程2.1.0
我的测试并行运行。
经过几天,我的测试在通过jenkins运行时未能完成,运行陷入进程,无法继续进行其余的运行。运行20多个场景时,我可以间歇地在本地重现该错误。我收到以下异常,以前有人见过此问题吗?
OpenQA.Selenium.WebDriverException:引发了具有空响应的异常,该异常将HTTP请求发送到URL http://localhost:7056/hub/session/d0a83b9c-bd79-4218-8eac-dc8b273f8f40/element/%7B84966a91-06c4-42dd-98c0-278ed35e3667%7D/attribute/value的远程WebDriver服务器。
异常的状态为ConnectFailure,并且消息为:无法连接到远程服务器
----> System.Net.WebException:无法连接到远程服务器
----> System.Net.Sockets.SocketException:无法建立连接,因为目标计算机主动拒绝它127.0.0.1:7056
+++++++++++++++++++
堆栈跟踪:
在OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest请求)
在OpenQA.Selenium.Firefox.FirefoxDriverCommandExecutor.Execute(Command commandToExecute)
在OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute,Dictionary 2 parameters) at OpenQA.Selenium.Remote.RemoteWebElement.GetAttribute(String attributeName) at TeamHours.Automation.StandAlone.WebComponents.Pages.WeeklySalesForecastPage.<Save>b__0(IWebElement s) in c:\Program Files (x86)\Jenkins\jobs\Automation Build Develop\workspace\TeamHours.Automation.StandAlone.WebComponents\Pages\WeeklySalesForecastPage.cs:line 38 at System.Linq.Enumerable.WhereSelectEnumerableIterator
2.MoveNext()
在System.Linq.Enumerable.Any [TSource](IEnumerable 1 source, Func
2谓词)处
在TeamHours.Automation.StandAlone.WebComponents.Pages.WeeklySalesForecastPage.Save()中,位于c:\ Program Files(x86)\ Jenkins \ jobs \ Automation Build Develop \ workspace \ TeamHours.Automation.StandAlone.WebComponents \ Pages \ WeeklySalesForecastPage.cs: 39行
在TeamHours.Automation.StandAlone.CommonSteps.Steps.SalesForecast.WeeklySalesForecastGraphsSteps.WhenISaveTheForecast()在c:\ Program Files(x86)\ Jenkins \ jobs \ Automation Build Develop \ workspace \ TeamHours.Automation.StandAlone.CommonStep WeeklySalesForecastGraphsSteps.cs:第73行
在TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding处(IBinding绑定,IContextManager contextManager,Object []参数,ITestTracer testTracer,TimeSpan&持续时间)
在TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStepMatch(BindingMatch匹配,Object []参数)处
在TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStep(StepInstance stepInstance)处
在TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnAfterLastStep()
在TeamHours.Automation.StandAlone.RegresionTests.Features.Schedule.ScheduleGraphFeature.ScenarioCleanup()中的c:\ Program Files(x86)\ Jenkins \ jobs \ Automation Build Develop \ workspace \ TeamHours.Automation.StandAlone.RegresionTests \ Features ScheduleGraph.feature.cs:第0行
在TeamHours.Automation.StandAlone.RegresionTests.Features.Schedule.ScheduleGraphFeature.VerifyScheduleGraphShowsCorrectPeopleAndOverstaffedWhenDemandIsExceeded(String角色,String选项卡,String链接,String noOfItems,String peopleRequired,String itemsOrSales,String total2,String tab2,String view, c:\ Program Files(x86)\ Jenkins \ jobs \ Automation Build Develop \ workspace \ TeamHours.Automation.StandAlone.RegresionTests \ Features \ Schedule \ ScheduleGraph.feature:line 133中的String type2,String type3,String [] exampleTags)
--WebException
在System.Net.HttpWebRequest.GetResponse()
在OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest请求)
--SocketException
在System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot,SocketAddress socketAddress)
在System.Net.ServicePoint.ConnectSocketInternal处(布尔connectFailure,Socket s4,Socket s6,Socket&套接字,IPAddress&地址,ConnectSocketState状态,IAsyncResult asyncResult,Exception&异常)
最佳答案
我们发现此问题可能与主机上的TCP端口耗尽有关。关于此还有其他资料,但是基本上,Web驱动程序会耗尽所有端口,使它们陷入等待状态,这是由于驱动程序轮询OS的可用端口。该修复程序涉及修改注册表,以增加可用端口的数量或减少它们处于等待状态的时间。
关于c# - OpenQA.Selenium.WebDriverException:引发了具有空响应的异常,并暂停了 Selenium 测试运行,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/39487175/