0

Please note that I have tried all the explanations available (mostly) and still not working.

The command I'm using to launch the browser session is as follows:

chrome --remote-debugging-port=9222 --user-data-dir="D:\SQA\Browser_data\ChromeData"

And my code is this:

package base;
import io.github.bonigarcia.wdm.WebDriverManager;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeOptions;

public class TestBase {

    public static WebDriver driver;

    public static void main(String[] args) {

        ChromeOptions options = new ChromeOptions();
        options.setExperimentalOption("debuggerAddress", "127.0.0.1:9222");

        driver = WebDriverManager.chromedriver().capabilities(options).create();

        driver.manage().window().maximize();
        driver.get("https://www.google.com");

        driver.quit();
    }
}

And I'm having the following error:

Caused by: org.openqa.selenium.remote.http.ConnectionFailedException: Unable to establish websocket connection to http://127.0.0.1:9222/devtools/browser/bb99bf32-06df-4f9f-a7f8-8408b3dbf391

1 Answers1

0

Found a tweak. Probably it's the data location in --user-data-dir flag.

Adding Chrome's default User Data location in the command argument/flag solves the problem. But I'm still curious to use other directories to save user data.

Looking forward to further responses. Thanks.