'Chromedriver Selenium getting 'Connection Reset' when versions match

I am using chromedriver but am sometimes getting the following errors:

03:34:09.188 [AsyncHttpClient-1-2] WARN org.openqa.selenium.remote.http.WebSocket - Connection reset
2022-01-05 21:34:09java.net.SocketException: Connection reset
2022-01-05 21:34:09at java.base/sun.nio.ch.SocketChannelImpl.throwConnectionReset(SocketChannelImpl.java:367)
2022-01-05 21:34:0903:34:09.180 [AsyncHttpClient-1-2] WARN org.asynchttpclient.netty.handler.WebSocketHandler - onError
2022-01-05 21:34:09java.net.SocketException: Connection reset
2022-01-05 21:34:09at java.base/sun.nio.ch.SocketChannelImpl.throwConnectionReset(SocketChannelImpl.java:367)
2022-01-05 21:34:09at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:398)
2022-01-05 21:34:09at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:253)
2022-01-05 21:34:09at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1134)
2022-01-05 21:34:09at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:350)
2022-01-05 21:34:09at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:151)
2022-01-05 21:34:09at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719)
2022-01-05 21:34:09at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655)
2022-01-05 21:34:09at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581)
2022-01-05 21:34:09at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
2022-01-05 21:34:09at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
2022-01-05 21:34:09at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
2022-01-05 21:34:09at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
2022-01-05 21:34:09at java.base/java.lang.Thread.run(Thread.java:832)

I have:

ARG CHROME_VERSION=96.0.4664.45-1
ARG CHROME_DRIVER_VERSION=96.0.4664.45

and I am using selenium 4:

<dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>4.1.1</version>
        </dependency>

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-api</artifactId>
            <version>4.1.1</version>
        </dependency>

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-remote-driver</artifactId>
            <version>4.1.1</version>
        </dependency>

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-chrome-driver</artifactId>
            <version>4.1.1</version>
        </dependency>

Note selenium 4 supports CDP up to v96 per https://github.com/SeleniumHQ/selenium/blob/201fad38296f9ea47ac1b1b59c160963dc7b2907/java/CHANGELOG

So I think the chromedriver and chrome version match. Does anyone know what could be causing the connection reset?



Solution 1:[1]

I think you should change driver.close to .quit

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ????? ??????????