Home > Mobile >  How to resolve java.net.SocketException: Connection reset exception in java with selenium?
How to resolve java.net.SocketException: Connection reset exception in java with selenium?

Time:11-13

When I am trying to driver.close() then I can get:

java.net.SocketException: Connection reset exception.

How to resolve it?

I'm writting a code like this:

driver.findElement(By.xpath("//*[text()='Log Out']")).click();
driver.close();

CodePudding user response:

You have version problems

  1. Check your chromedriver version
  2. Check your chrome version
  3. Check your selenium version

They all should be compatible with each other

For example, if you are using chrome browser version 'Version 95.0.4638.69' you should have the same version for chromedriver.

CodePudding user response:

To get rid of the residual chores generated during the test execution and interfere in your next test execution, instead of driver.close() always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.

  • Related