OS: Win7 64bit Browser:Chrome
I'm working on my assignment to test a program with selenium. I'm using the code provided by the professor,which creates a web-app on my localhost:8080 (So there shouldn't be any connection problem)
public void canConenctTwoPlayers() {
// connect
//2: missing code
this.indexPage.connect.click();
assertThat(this.indexPage.hasText("Successfully connected to the game with unique "), is(true));
this.indexPage.numberPlayers.click();
this.indexPage.numberPlayers.sendKeys("2");
this.indexPage.open.click();
//second connect
ChromeDriver second_player = quickConnectAnotherUser();
//3: missing code
assertThat(this.indexPage.hasText("The game is now ready to begin"), is(true));
// quit
//4: missing code
disconnectSecondUser(second_player);
this.indexPage.disconnect.click();
}
In here numberPlayers is the element in the window, where as it name says, input the number of players. But when i use sendKeys, it gives me this exception
java.io.IOException: java.util.concurrent.ExecutionException:
java.io.IOException: Connection was aborted by the software in your host machine
And when i comment out the sendkeys, the code works well.
2018-11-30 13:24:52.749 INFO 18632 --- [nio-8080-exec-1] c.c.poker.game.PokerSocketHandler : Opened new session for _fc6yznc.
2018-11-30 13:24:52.749 INFO 18632 --- [nio-8080-exec-1] ca.carleton.poker.game.PokerGame : Player is trying to connect _fc6yznc, WebSocketServerSockJsSession[id=_fc6yznc]
2018-11-30 13:24:52.749 INFO 18632 --- [nio-8080-exec-1] ca.carleton.poker.game.PokerGame : Setting first player as admin:_fc6yznc.
2018-11-30 13:24:52.749 INFO 18632 --- [nio-8080-exec-1] ca.carleton.poker.game.PokerGame : Player is being added _fc6yznc, WebSocketServerSockJsSession[id=_fc6yznc]
2018-11-30 13:24:52.750 INFO 18632 --- [nio-8080-exec-1] ca.carleton.poker.game.PokerGame : Sessions WebSocketServerSockJsSession[id=_fc6yznc]
2018-11-30 13:24:52.750 INFO 18632 --- [nio-8080-exec-1] c.c.poker.game.PokerSocketHandler : Sending admin message to player.
2018-11-30 13:24:52.750 INFO 18632 --- [nio-8080-exec-1] ca.carleton.poker.game.PokerGame : Current number of players is 1. Required number is 4.
2018-11-30 13:24:52.872 ERROR 18632 --- [nio-8080-exec-2] c.c.poker.game.PokerSocketHandler : TRANSPORT ERROR - Error with the network.
java.io.IOException: java.util.concurrent.ExecutionException: java.io.IOException: Connection was aborted by the software in your host machine
at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.startMessageBlock(WsRemoteEndpointImplBase.java:282)
at org.apache.tomcat.websocket.WsSession.sendCloseMessage(WsSession.java:570)
at org.apache.tomcat.websocket.WsSession.onClose(WsSession.java:510)
at org.apache.tomcat.websocket.WsFrameBase.processDataControl(WsFrameBase.java:342)
at org.apache.tomcat.websocket.WsFrameBase.processData(WsFrameBase.java:284)
at org.apache.tomcat.websocket.WsFrameBase.processInputBuffer(WsFrameBase.java:130)
at org.apache.tomcat.websocket.server.WsFrameServer.onDataAvailable(WsFrameServer.java:60)
at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler$WsReadListener.onDataAvailable(WsHttpUpgradeHandler.java:203)
at org.apache.coyote.http11.upgrade.AbstractServletInputStream.onDataAvailable(AbstractServletInputStream.java:198)
at org.apache.coyote.http11.upgrade.AbstractProcessor.upgradeDispatch(AbstractProcessor.java:96)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:663)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1521)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1478)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Caused by: java.util.concurrent.ExecutionException: java.io.IOException: Connection was aborted by the software in your host machine
at org.apache.tomcat.websocket.FutureToSendHandler.get(FutureToSendHandler.java:102)
at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.startMessageBlock(WsRemoteEndpointImplBase.java:275)
... 16 common frames omitted
Caused by: java.io.IOException: Connection was aborted by the software in your host machine
at sun.nio.ch.SocketDispatcher.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(Unknown Source)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(Unknown Source)
at sun.nio.ch.IOUtil.write(Unknown Source)
at sun.nio.ch.SocketChannelImpl.write(Unknown Source)
at org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:127)
at org.apache.tomcat.util.net.NioSelectorPool.write(NioSelectorPool.java:184)
at org.apache.coyote.http11.upgrade.NioServletOutputStream.doWriteInternal(NioServletOutputStream.java:94)
at org.apache.coyote.http11.upgrade.NioServletOutputStream.doWrite(NioServletOutputStream.java:61)
at org.apache.coyote.http11.upgrade.AbstractServletOutputStream.writeInternal(AbstractServletOutputStream.java:165)
at org.apache.coyote.http11.upgrade.AbstractServletOutputStream.write(AbstractServletOutputStream.java:132)
at org.apache.tomcat.websocket.server.WsRemoteEndpointImplServer.onWritePossible(WsRemoteEndpointImplServer.java:98)
at org.apache.tomcat.websocket.server.WsRemoteEndpointImplServer.doWrite(WsRemoteEndpointImplServer.java:80)
at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.writeMessagePart(WsRemoteEndpointImplBase.java:450)
at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.startMessage(WsRemoteEndpointImplBase.java:338)
at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.startMessageBlock(WsRemoteEndpointImplBase.java:270)
... 16 common frames omitted
2018-11-30 13:24:52.872 INFO 18632 --- [nio-8080-exec-2] c.c.poker.game.PokerSocketHandler : Closing session for _fc6yznc with status CloseStatus[code=1000, reason=null].
2018-11-30 13:24:52.872 INFO 18632 --- [nio-8080-exec-2] c.c.poker.game.PokerSocketHandler : Disabling all accounts because the admin left.
2018-11-30 13:24:52.873 INFO 18632 --- [nio-8080-exec-2] ca.carleton.poker.game.PokerGame : Sessions WebSocketServerSockJsSession[id=_fc6yznc]
2018-11-30 13:24:52.873 INFO 18632 --- [nio-8080-exec-2] c.carleton.poker.session.SessionHandler : Registered _fc6yznc for disconnect.