taing hong
taing hong

Reputation: 33

Selenium test returns same error java.net.SocketException with chrome and egde

i have a very basic test with selenium. i tried with chrome then with edge. the test runs but at the end, there an error and the test never stops by itself. I have the same version for chromedriver and chromimum and chrome. I hace the same version edge driver and edge. i'm using this version for selenium: selenium-java-4.0.0-alpha-6 Here is the code:

public class Test2 {   
    public static void main(String[] args) throws InterruptedException {      
        System.setProperty("webdriver.edge.driver", "C:\\selenium\\edge\\msedgedriver.exe");
        WebDriver driver = new EdgeDriver();  
        // Launch website  
        driver.navigate().to("http://www.google.com/");         
        Thread.sleep(2000);
        driver.close();     
    }   
}

Here is the error trace:

Starting MSEdgeDriver 87.0.664.47 (ba159091e772c52e16e8d82850f3c8b934507b5d)
on port 2793 Only local connections are allowed. 
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping MSEdgeDriver safe.
MSEdgeDriver was started successfully. Nov. 25, 2020 12:06:43 P.M.
org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Detected dialect: W3C 13486 
[AsyncHttpClient-3-3] WARN org.asynchttpclient.netty.handler.WebSocketHandler - onError java.net.SocketException: Connection reset
    at java.base/sun.nio.ch.SocketChannelImpl.throwConnectionReset(SocketChannelImpl.java:345)
    at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:376)
    at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:253)
    at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1133)
    at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:350)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.base/java.lang.Thread.run(Thread.java:830) Nov. 25, 2020
12:06:51 P.M. org.openqa.selenium.remote.http.WebSocket$Listener
onError WARNING: Connection reset java.net.SocketException: Connection reset
    at java.base/sun.nio.ch.SocketChannelImpl.throwConnectionReset(SocketChannelImpl.java:345)
    at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:376)
    at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:253)
    at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1133)
    at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:350)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.base/java.lang.Thread.run(Thread.java:830)

Upvotes: 0

Views: 7929

Answers (2)

taing hong
taing hong

Reputation: 33

It works. my libraries were not correct. I downloaded the right library.

Latest working version : selenium-java-3.141.59

Upvotes: 0

Arthur Prin
Arthur Prin

Reputation: 21

You can use driver.quit();

Best regards.

Upvotes: 2

Related Questions