I am executing my Selenium tests against a Grid server, hosted on a different machine. My grid invocation is (bat file):
cd c:\
start java -jar c:\selenium-server-standalone-2.46.0.jar -role hub -registerCycle=5000 -browserTimeout=60
start java -jar selenium-server-standalone-2.46.0.jar -role webdriver -hub \
http://localhost:4444/grid/register -port 4445 \
-Dwebdriver.chrome.driver=C:\chromedriver.exe \
-browser="platform=WINDOWS,browserName=chrome,maxInstances=" \
-browser="browserName=firefox,maxInstances=1" \
-Dwebdriver.ie.driver=C:\IEDriverServer.exe \
-browser="browserName=internet explorer,maxInstances=1"
(Disregard '\', I'm using this for formatting on StackExchange only. My file is one line).
Some more details....
OS: Win 7 Pro IE Version: 8
Everything works great for the first 25 or 26 tests, and then they all fail after that (approx. 200). If I run these locally, they pass. It's kind of hard to catch, but it seems that when the problem happens, after my call to
Driver.Close();
Thread.Sleep(1000);
Driver.Quit();
... that Grid fails to close the current Internet Explorer handle and then creates a new one. So now, I have two handles open. The most instances of IE I have ever seen open is 3-4.
When I check my node instance after it's finished running, I have the following exception:
20:17:49.725 INFO - Available nodes: [http://172.30.33.246:4445]
20:17:49.741 INFO - Trying to create a new session on node http://172.30.33.246:4445
20:17:49.741 INFO - Trying to create a new session on test slot {seleniumProtocol=WebDriver, browserName=internet explorer, maxInstances=1, platform=WINDO
WS}
20:17:52.845 WARN - IOException thrown while closing Closeable.
org.seleniumhq.jetty7.io.EofException
at org.seleniumhq.jetty7.http.HttpGenerator.flushBuffer(HttpGenerator.java:939)
at org.seleniumhq.jetty7.server.AbstractHttpConnection.flushResponse(AbstractHttpConnection.java:612)
at org.seleniumhq.jetty7.server.AbstractHttpConnection$Output.close(AbstractHttpConnection.java:1001)
at com.google.common.io.Closeables.close(Closeables.java:79)
at org.openqa.selenium.io.IOUtils.closeQuietly(IOUtils.java:45)
at org.openqa.grid.internal.TestSession.writeRawBody(TestSession.java:440)
at org.openqa.grid.internal.TestSession.forward(TestSession.java:266)
at org.openqa.grid.web.servlet.handler.RequestHandler.forwardNewSessionRequestAndUpdateRegistry(RequestHandler.java:88)
at org.openqa.grid.web.servlet.handler.RequestHandler.process(RequestHandler.java:111)
at org.openqa.grid.web.servlet.DriverServlet.process(DriverServlet.java:83)
at org.openqa.grid.web.servlet.DriverServlet.doPost(DriverServlet.java:67)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.seleniumhq.jetty7.servlet.ServletHolder.handle(ServletHolder.java:565)
at org.seleniumhq.jetty7.servlet.ServletHandler.doHandle(ServletHandler.java:479)
at org.seleniumhq.jetty7.server.session.SessionHandler.doHandle(SessionHandler.java:225)
at org.seleniumhq.jetty7.server.handler.ContextHandler.doHandle(ContextHandler.java:1031)
at org.seleniumhq.jetty7.servlet.ServletHandler.doScope(ServletHandler.java:406)
at org.seleniumhq.jetty7.server.session.SessionHandler.doScope(SessionHandler.java:186)
at org.seleniumhq.jetty7.server.handler.ContextHandler.doScope(ContextHandler.java:965)
at org.seleniumhq.jetty7.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.seleniumhq.jetty7.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
at org.seleniumhq.jetty7.server.Server.handle(Server.java:349)
at org.seleniumhq.jetty7.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:452)
at org.seleniumhq.jetty7.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:47)
at org.seleniumhq.jetty7.server.AbstractHttpConnection.content(AbstractHttpConnection.java:894)
at org.seleniumhq.jetty7.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:948)
at org.seleniumhq.jetty7.http.HttpParser.parseNext(HttpParser.java:857)
at org.seleniumhq.jetty7.http.HttpParser.parseAvailable(HttpParser.java:230)
at org.seleniumhq.jetty7.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:66)
at org.seleniumhq.jetty7.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:254)
at org.seleniumhq.jetty7.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)
at org.seleniumhq.jetty7.util.thread.QueuedThreadPool3ドル.run(QueuedThreadPool.java:534)
at java.lang.Thread.run(Unknown Source)
Caused by: java.net.SocketException: Software caused connection abort: socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(Unknown Source)
at java.net.SocketOutputStream.write(Unknown Source)
at org.seleniumhq.jetty7.io.ByteArrayBuffer.writeTo(ByteArrayBuffer.java:354)
at org.seleniumhq.jetty7.io.bio.StreamEndPoint.flush(StreamEndPoint.java:159)
at org.seleniumhq.je
tty7.io.bio.StreamEndPoint.flush(StreamEndPoint.java:177)
at org.seleniumhq.jetty7.http.HttpGenerator.flushBuffer(HttpGenerator.java:863)
... 33 more
The goal is to have all of these tests passing when running on the Grid server. And again, they all pass locally while running in IE8.
1 Answer 1
We had faced same issues in the past. On node server before launching new node check any existing instance was running. Forcefully close the browser instances before again passing control back. Added bat file to do this functionality. It works perfect.
Explore related questions
See similar questions with these tags.