我们在Selenium Grid中不断面临浏览器超时问题。发生是间歇性的。我们无法找到原因。
如果有人有任何想法,那将有很大帮助。
硒罐:3.14.0 铬驱动程序:2.41 附录:1.8.1 java_client:5.0.4
[INFO ] 17:01:15.145 com.ytlctest.e2evalidation.pagefunctions.DaoPageFuncs.loginPage() - Login to WOM
[INFO ] 17:01:15.145 com.ytlctest.lib.MainUtil.launchURL() - Launching the URL
[ERROR] 17:01:15.161 com.ytlctest.lib.MainUtil.launchURL() - Text not typed
[ERROR] 17:01:15.162 com.ytlctest.lib.MainUtil.launchURL() - EXCEPTIONTEXTMETHOD launchURL
org.openqa.selenium.WebDriverException: Session [4c1df58d0fbcc5da00e18fe779040941] was terminated due to TIMEOUT
Command duration or timeout: 0 milliseconds
at sun.reflect.GeneratedConstructorAccessor28.newInstance(Unknown Source) ~[?:?]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_181]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_181]
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214) ~[selenium-remote-driver-3.14.0.jar:?]
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166) ~[selenium-remote-driver-3.14.0.jar:?]
at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40) ~[selenium-remote-driver-3.14.0.jar:?]
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80) ~[selenium-remote-driver-3.14.0.jar:?]
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44) ~[selenium-remote-driver-3.14.0.jar:?]
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158) ~[selenium-remote-driver-3.14.0.jar:?]
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548) ~[selenium-remote-driver-3.14.0.jar:?]
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:276) ~[selenium-remote-driver-3.14.0.jar:?]
at com.ytlctest.lib.MainUtil.launchURL(MainUtil.java:78) [selfra-0.0.32.jar:?]
at com.ytlctest.e2evalidation.pagefunctions.DaoPageFuncs.loginPage(DaoPageFuncs.java:39) [selfra-0.0.32.jar:?]
at com.ytlctest.e2evalidation.WOMAutomation.runWomTest(WOMAutomation.java:48) [selfra-0.0.32.jar:?]
at com.ytlctest.myyes4g.testCases.myyes4gPostpaidAddon.postpaidAddonPurchase(myyes4gPostpaidAddon.java:78) [classes/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124) [testng-6.14.3.jar:?]
at org.testng.internal.Invoker.invokeMethod(Invoker.java:583) [testng-6.14.3.jar:?]
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:719) [testng-6.14.3.jar:?]
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:989) [testng-6.14.3.jar:?]
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125) [testng-6.14.3.jar:?]
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109) [testng-6.14.3.jar:?]
at org.testng.TestRunner.privateRun(TestRunner.java:648) [testng-6.14.3.jar:?]
at org.testng.TestRunner.run(TestRunner.java:505) [testng-6.14.3.jar:?]
at org.testng.SuiteRunner.runTest(SuiteRunner.java:455) [testng-6.14.3.jar:?]
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450) [testng-6.14.3.jar:?]
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415) [testng-6.14.3.jar:?]
at org.testng.SuiteRunner.run(SuiteRunner.java:364) [testng-6.14.3.jar:?]
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) [testng-6.14.3.jar:?]
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84) [testng-6.14.3.jar:?]
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208) [testng-6.14.3.jar:?]
at org.testng.TestNG.runSuitesLocally(TestNG.java:1137) [testng-6.14.3.jar:?]
at org.testng.TestNG.runSuites(TestNG.java:1049) [testng-6.14.3.jar:?]
at org.testng.TestNG.run(TestNG.java:1017) [testng-6.14.3.jar:?]
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:283) [surefire-testng-2.21.0.jar:2.21.0]
at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75) [surefire-testng-2.21.0.jar:2.21.0]
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:120) [surefire-testng-2.21.0.jar:2.21.0]
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:379) [surefire-booter-2.21.0.jar:2.21.0]
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:340) [surefire-booter-2.21.0.jar:2.21.0]
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:125) [surefire-booter-2.21.0.jar:2.21.0]
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:413) [surefire-booter-2.21.0.jar:2.21.0]
Caused by: org.openqa.selenium.WebDriverException: Session [4c1df58d0fbcc5da00e18fe779040941] was terminated due to TIMEOUT
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'
System info: host: 'SN2YCVW1B0003', ip: '10.10.1.248', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_181'
Driver info: driver.version: unknown
at org.openqa.grid.internal.ActiveTestSessions.getExistingSession(ActiveTestSessions.java:115) ~[?:?]
at org.openqa.grid.internal.DefaultGridRegistry.getExistingSession(DefaultGridRegistry.java:379) ~[?:?]
at org.openqa.grid.web.servlet.handler.RequestHandler.getSession(RequestHandler.java:241) ~[?:?]
at org.openqa.grid.web.servlet.handler.RequestHandler.process(RequestHandler.java:123) ~[?:?]
at org.openqa.grid.web.servlet.DriverServlet.process(DriverServlet.java:85) ~[?:?]
at org.openqa.grid.web.servlet.DriverServlet.doPost(DriverServlet.java:69) ~[?:?]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) ~[?:?]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) ~[?:?]
at org.seleniumhq.jetty9.servlet.ServletHolder.handle(ServletHolder.java:860) ~[?:?]
at org.seleniumhq.jetty9.servlet.ServletHandler.doHandle(ServletHandler.java:535) ~[?:?]
at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:143) ~[?:?]
at org.seleniumhq.jetty9.security.SecurityHandler.handle(SecurityHandler.java:548) ~[?:?]
at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) ~[?:?]
at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190) ~[?:?]
at org.seleniumhq.jetty9.server.session.SessionHandler.doHandle(SessionHandler.java:1595) ~[?:?]
at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188) ~[?:?]
at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1253) ~[?:?]
at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168) ~[?:?]
at org.seleniumhq.jetty9.servlet.ServletHandler.doScope(ServletHandler.java:473) ~[?:?]
at org.seleniumhq.jetty9.server.session.SessionHandler.doScope(SessionHandler.java:1564) ~[?:?]
at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166) ~[?:?]
at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1155) ~[?:?]
at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[?:?]
at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) ~[?:?]
at org.seleniumhq.jetty9.server.Server.handle(Server.java:530) ~[?:?]
at org.seleniumhq.jetty9.server.HttpChannel.handle(HttpChannel.java:347) ~[?:?]
at org.seleniumhq.jetty9.server.HttpConnection.onFillable(HttpConnection.java:256) ~[?:?]
at org.seleniumhq.jetty9.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279) ~[?:?]
at org.seleniumhq.jetty9.io.FillInterest.fillable(FillInterest.java:102) ~[?:?]
at org.seleniumhq.jetty9.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124) ~[?:?]
at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247) ~[?:?]
at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140) ~[?:?]
at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131) ~[?:?]
at org.seleniumhq.jetty9.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:382) ~[?:?]
at org.seleniumhq.jetty9.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708) ~[?:?]
at org.seleniumhq.jetty9.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:626) ~[?:?]
at java.lang.Thread.run(Unknown Source) ~[?:1.8.0_181]
hub.json
Java -jar Selenium-server-standalone-3.14.0.jar -role hub -browserTimeout 120000 -port 4545
{
"host": "10.28.19.251",
"port": 4545,
"newSessionWaitTimeout": -1,
"servlets" : [],
"prioritizer": null,
"capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
"throwOnCapabilityNotPresent": true,
"nodePolling": 5000,
"cleanUpCycle": 5000,
"timeout": 30000,
"browserTimeout": 120000,
"maxSession": 5,
"jettyMaxThreads": 10
}
Node.json
Java -jar Selenium-server-standalone-3.14.0.jar -role node -browserTimeout 120000 -hub http://10.28.19.251:4545/grid/register
{
"capabilities":
[
{
"webdriver.chrome.driver": "C:/seleniumserver/chromedriver.exe",
"browserName": "chrome",
"maxInstances": 5,
"seleniumProtocol": "WebDriver",
"version": 2.41
}
],
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"maxSession": 5,
"port": 4502,
"host": "127.0.0.1",
"register": true,
"registerCycle": 5000,
"hub": "http://10.28.19.251:4545",
"nodeStatusCheckTimeout": 5000,
"nodePolling": 5000,
"role": "node",
"browserTimeout": "120000",
"unregisterIfStillDownAfter": 60000,
"downPollingLimit": 2,
"debug": false,
"servlets" : [],
"withoutServlets": [],
"custom": {}
}
这在很大程度上取决于硒网格配置。在您的配置 json 中可见,您已使用该属性maxSession
请将其更改为maxInstances
。不应限制网格上的最大会话数。即使你想保留这个属性,也要让它像1000左右。
还要消除属性newSessionWaitTimeout
。让我们使用默认配置的值。
因为我们了解使用硒网格的唯一问题是维护,因为它需要在集线器和节点的基础上定期重新启动。我建议使用一些第三方包装器,以便更好,更轻松地维护。你可以试试Groupon的SeleniumGridExtras。