Test Automation

Connectionfailedexception selenium


You might get some If you’ve recently updated your Chrome browser to version 115. x, you might encounter the “org.openqa.selenium.remote.http.ConnectionFailedException” exception.

you may also come across another issue that is “org.openqa.selenium.SessionNotCreatedException“.

Here’s a solution to quickly address these issues.


The errors are:

Error 1 | org.openqa.selenium.remote.http.ConnectionFailedException



The window is merely opened, but it never proceeds, and as a result, this exception is raised.


Add this line of code while initializing your driver and mostly with Chrome driver.


Note: You will observe this issue only with Selenium 4.X only.

Error 2 | org.openqa.selenium.SessionNotCreatedException

In certain instances, you may encounter the following error during Chrome driver initialization.

org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500.


Incorporate the following line of code, and it will resolve your issue.


To confirm the Chrome version that is on your system, Open the browser, go to setting, and About Chrome, Here is the version, note it down.

Note: In some cases updates are installed automatically, and relaunch of the browser is mandatory, so relaunch in that case to see the accurate version of the Chrome browser.


Following is the code where these issues addressed, The Code Open the Chrome browser with the help of driver.

package com.yousafzai.tests;

import com.yousafzai.pageobjects.LandingPage;
import io.github.bonigarcia.wdm.WebDriverManager;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;

import java.io.IOException;
import java.time.Duration;

public class LandingPageTests {

    WebDriver driver;

    public void setUp() {
        try {
            driver = new ChromeDriver();
            // Configure implicit wait for 10 seconds
            // Maximize the browser window
        } catch (Exception e) {

    public void testLogin() throws IOException {

    public void tearDown() {
        // Close the browser


<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
    <!-- https://mvnrepository.com/artifact/org.testng/testng -->
    <!-- https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager -->

Alternative Solutions

Root Directory Placement

  • Place the ChromeDriver executable in your project’s root directory.
  • Modify your test script to set the ChromeDriver path with System.setProperty.

In some case you might need to set the path with the help of below command.

System.setProperty("webdriver.chrome.driver", "chromedriver.exe");

System Property Configuration:

  • Set the ChromeDriver path externally using System.setProperty.
  • Specify the path to the ChromeDriver executable in your test script.
System.setProperty("webdriver.chrome.driver", "/path/to/chromedriver");

These alternative methods offer flexibility for configuring ChromeDriver path settings to match your project’s requirements.

Other Tips and Considerations

Following are some good habits one mush consider while dealing with Test automation.

Keep Chrome and ChromeDriver Updated

Regularly update your Chrome browser and ChromeDriver to ensure compatibility and access to the latest features and bug fixes.

Check for Automatic Updates

Be aware that Chrome updates can occur automatically. After updates, remember to check for a new ChromeDriver version that matches your browser.

Use Explicit Waits When Necessary

While implicit waits are useful, consider using explicit waits for specific elements or actions when dealing with dynamic web pages to enhance test stability.

Logging and Error Handling

Implement robust logging and error-handling mechanisms in your test scripts to capture detailed information about failures and debugging.

Conclusion | Connectionfailedexception selenium

“Two commonly occurring issues are ‘org.openqa.selenium.remote.http.ConnectionFailedException’ and ‘The window is opened but never proceeds, leading to this exception.’ This blog provides potential solutions for both problems. In most cases, these issues arise with the latest Chrome build and Selenium version 4. Please share the blog with others experiencing the same problems.”

Rashid Ali

I am an IT professional with 10 years of experience in the field of Software development. My track record of satisfied clients speaks to my proficiency in delivering top-notch services in QA manual and Automation, IT support services, Blogging , and On-page SEO.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button