Failed to launch chrome browser using selenium 4.8.2

Currently there are few issues users are facing when executing Selenium tests on chrome browser.

If have upgraded your chrome browser recently, you will see below issue -

1. Starting ChromeDriver 111.0.5563.64 (c710e93d5b63b7095afe8c2c17df34408078439d-refs/branch-heads/5563@{#995}) on port 13894
Only local connections are allowed.
Please see for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.

org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: unknown error: Chrome failed to start: exited normally.
(unknown error: DevToolsActivePort file doesn't exist)

If you are using Java 8, you can temporarily add an argument to your ChromeOptions instance like below : -

Solution 1 -

ChromeOptions options = new ChromeOptions();

WebDriver driver = new ChromeDriver(options);

Note the above solution may not work for java.version: '11'.

Solution 2 -
I was also able to resolve by specifying chrome profile (both default and user profile worked.)

ChromeOptions options = new ChromeOptions();
options.addArguments("--user-data-dir=C:\\Users\\username\\AppData\\Local\\Google\\Chrome\\User Data\\Profile 1");
//options.addArguments("--user-data-dir=C:\\Users\\username\\AppData\\Local\\Google\\Chrome\\User Data\\Default");
WebDriver driver = new ChromeDriver(options); 

You can always check Profile Path and Executable Path by typing chrome://version/ in the address bar.

This solution worked and confirmed with Selenium 4.8.2, Chromedriver version '111.0.5563.64' and Chrome browser '111.0.5563.147'

Solution 3 -
If the above option is not helping / resolving issue, it could be probably you are using Java 11+ version. To fix this, please update to the latest HTTP Client.

The default client is required for backwards compatibility with Java 8, but has not been maintained and is not in as good of shape; the new client is better and will be what we use when we (eventually) remove support for Java 8.


and need to set property as below, Please find more details on this Using Java 11+ HTTP Client in Selenium 4.5.0 and beyond

System.setProperty("webdriver.http.factory", "jdk-http-client");

If you are using Headless, as we know from Chrome 109 and above, the '--headless=new' flag will be used to get the full functionality of Chrome in the new headless mode. (For Chrome versions 96 through 108, use --headless=chrome). For more details Selenium new headless execution


Please do let us know if you have any other solution that is working.

Selenium Tutorials: