User Data Directory Is Already In Use


I am trying to launch chrome with a specific profile. I already tried 2 methods. Adding the arguments via settings, and I tried adding the arguments on a script basis which was posted here. Open Browser with Custom Profile

I am opening successfull chrome on my profile. But afterwards I get the error. I am using up to date chrome, chromedriver and Katalon Studio. Anyone tips on what causes the error, I can´t find any way to fix it.

org.openqa.selenium.InvalidArgumentException: invalid argument: user data directory is already in use, please specify a unique value for --user-data-dir argument, or don’t use --user-data-dir

I know this. You have one or more Chrome browser opened manually before you start the test. Contention arises for the default user-data directory. Chrome browser is apparently designed very sensitive about the contention.

A quick work around is to close the Chrome browsers before you start the test. This way works, but very cumbersome.

Another work around is

The solution I came up with that has worked every time so far (15 tests currently) was to clone the profile to a location inside the project every time the program runs and then point selenium to that clone.

as quoted from

1 Like

Another solution for me would be to run one Window but running my task in multiple tabs simultaneously. But I haven´t find yet a way for this in Katalon Studio yet.

Thank you it worked for me. Problem here is -> 1 copy of a user-data directory == 1 Chrome Window.

Is there any way I can open more then one Chrome Window for one user-data directory?

I thought of creating temporary User-Data folders and loading them via arguments. But RunConfiguration.setWebDriverPreferencesProperty("args", "--user-data-dir" +tempfoldername) Is not working for me. I can´t override the Desired Capabilities eventhough with “–incognito”. So the whole override command is not working for me with Chrome. I haven´t found any other solution yet.

I tried with this class import org.openqa.selenium.remote.DesiredCapabilities as DesiredCapabilities
But while initzializing with this one, selenium starts working differently for me and not finding xpath´s which it was finding when not using this class.

Any solutions to this?

How do you create an instance of WebDriver at all?

Do you call RunConfiguration.setWebDriverPreferencesProperty() before you create the WebDriver instance, for after you have created it?

Possibly calling RunConfiguration.setWebDriverPreferencesProperty() after the WebDriver has been instantiated would have no effect to the already-running instance.

If I were you, I would do as follows:

import org.openqa.selenium.WebDriver
import org.openqa.selenium.remote.DesiredCapabilities
import com.kms.katalon.core.webui.driver.DriverFactory
DesiredCapabilities desiredCapabilities
// create a temporary User-Data directory, create a Profile in it
// copy the Profile contents from Chrome's default User-Data dir into the temporary dir
// setup the desiredCapabilities to specify a Profile in a temporary User-Data
WebDriver driver = new ChromeDriver(desiredCapabilities)

Please note that I do not call Katalon’s API such as RunConfiguration.setWebDriverPreferencesProperty() at all. I use the Selenium WebDriver API for creating and setting up the driver instance untill I call DriverFactory.changeWebDriver(driver) finally.

Thus I have good chance to control the way how to instantiate ChromeDriver.

I do not understand how your code looks like.

Hi there:

Here below are my two questions:
How to resolve the same issues in Katalon as this is Katalon Community. Running chrome in Katalon 7.2 or below throws exceptions like this; invalid argument: user data directory is already in use …
Internet explorer also doesn’t work even if I did adjust the zoom level 100%. No explanation for this one.
Katalon is currently running fine only in Firefox. It seems that you don’t have big community for support and I wish I wouldn’t have to use Katalon.


When you see this error, most probably, you have another window of Chrome which you opened manually. Please close that window, and try running the test. Then possibly you would not see the message of “invalid argument: user data directory is already in use”.

Thank for that idea. That may work for other folks but it didn’t work for me and I wish Katalon guys should tell us the truth why Chrome and IE didn’t work

Thanks again.