Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (19.7k points)

When I create a new chrome driver in Selenium while Google Chrome is already running AND I am referencing the user's settings/data (via user-data-dir). A new Chrome window will open, but my application will hang. The ChromeDriver console will display the following error each second: 

DevTools Request: DevTools request failed

Screenshot: enter image description here

Code to instantiate the driver:

ChromeDriverService driverService = ChromeDriverService.CreateDefaultService();

        //driverService.HideCommandPromptWindow = true;

        driverService.EnableVerboseLogging = true;

        string path = Environment.ExpandEnvironmentVariables("%LOCALAPPDATA%\\Google\\Chrome\\User Data");

        ChromeOptions options = new ChromeOptions();

        options.AddArguments("user-data-dir=" + path);



        IWebDriver driver = new ChromeDriver(driverService, options);

This will work perfectly fine in every instance if I do not try and load user settings/data. If I am trying to load user setting/data it will only work if there is no instance of Chrome running on the device already.


  • Selenium v 2.47.0
  • ChromeDriver v 2.16.333243
  • Chrome v44.0.2403

What can I do to resolve this?

1 Answer

0 votes
by (62.9k points)

This behaviour is by design. 2 instances of Chrome cannot use a similar user-data-dir at the same time. Otherwise, they'd try and update the same set of files and cause corruption. Therefore if an instance is already running, making an attempt to start another instance using the same user-data-dir would cause the second instance to ask the primary instance to open a new window, and so the second instance exits. 

Check out his link also:

Browse Categories