Open Browser with Custom Profile

This tutorial is inspired by this question:

Katalon Studio automatically prompts a new browser with no cached data for every test execution. However, sometimes you need to have some types of default state, for example, to verify that an action is taken when a user logs in for the first time ever. This test scenario requires that a new browser must be opened with some cached data. This tutorial is aimed to demonstrate how to do this scenario in Katalon Studio.

This tutorial will guide you through a simple test scenario that can be extended for your own purposes:

  • Open a browser.
  • Navigate to
  • The browser will re-direct you to your inbox.


The first step is to create a Chrome Profile that contains your gmail account’s information. Open your Chrome browser and navigate to chrome://settings/ . There clicking on Manage other people will open a panel. Click on Add person and choose the name for your Chrome Profile.

This will open a new Chrome instance with a new profile. Now proceed to log in your gmail account in this instance. After that, navigate to chrome://version/ . You should copy the path to the profile of this Chrome instance to your notepad or a text editor for latter use.


Now open Katalon Studio and create a new test case. Open the script mode and enter the following code:

import com.kms.katalon.core.webui.driver.DriverFactory
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import internal.GlobalVariable as GlobalVariable
import org.openqa.selenium.WebDriver

// Copy the path to chromedriver.exe
String pathToChromeDriver = "{katalon_installed_folder}\configuration\resources\drivers\chromedriver_win32\chromedriver.exe"
System.setProperty("", pathToChromeDriver)

// It is important that this chromeProfilePath ends with User Data and not with the profile folder (Profile 2)
String chromeProfilePath = "C:\\Users\\thanhto\\AppData\\Local\\Google\\Chrome\\User Data\\";
ChromeOptions chromeProfile = new ChromeOptions();
chromeProfile.addArguments("user-data-dir=" + chromeProfilePath);
// Here you specify the actual profile folder (Profile 2)
chromeProfile.addArguments("profile-directory=Profile 2");

WebDriver driver = new ChromeDriver(chromeProfile);

// Here you can continue your test case

Run the test case and the browser will navigate to and re-direct you to your own inbox.

Note: All Chrome browsers should be closed before running this test case


Hello Thanh,

Thanks for your solution. Although it is tedious, it worked.

It serves the purpose.

But do let me know if this can be simplified with any inbuilt keyword in future. We want to link up our automation scripts with CI tools in future.

Thanks & Regards,


Hi @aguggella

I will discuss with the team about this possibility and will let you know.

Regards !

I am seriously interested in this topic.

I tried the Thanh To’s approach, and found a difficulty.

In my Chrome, I created a User named Katalon with an avatar of white flower. I switched to the Katalon user, and retrieved chrome://version page. Please find the following screenshot.

I expected that the Profile path should ends with a directory named equal to the User name: Katalon. But actually it doesn’t. The actual profile path ends with a directory named Profile 2. The actual profile path seems automatically resolved by the Chrome browser, hence it can be environment dependent.

This runtime environment dependency causes a problem for writing test scripts. Say, I have 2 PCs. I want to run just the same Katalon project. I can code the Chrome profile name Katalon.

How can a test case code can not resolve a User Katalon to some Profile name: Profile 1 or Profile 2 or Profile 3?

Does anybody know how to resolve this relation by scripting? Or do I have to check chrome://version page everytime manually to find out the profile path of the Katalon user?

Or is it possible for me to force chromedriver to tell chrome browser to make a Profile ending with the user name I wanted Katalon.

One idea has come up to me.

How about using the Default profile directory always? I can expect the Default profile is there always. I would not add new User at all. I would use an existing Chrome user (no matter how it is named I should not mind it) which is resolved to the Default profile directory.


I am not following. You need another Chrome profile if you want to test on different profiles right ?

I want to execute my test on AWS EC2 with Jenkins. I want to terminate the EC2 instance once the test finished, and create another one next time. Therefore the Chrome profile directories will be empty at startup. My test suites will requires some cached resources (cookies especially). For that, I would prepare some cached resources and store it somewhere, and restore it into the EC2 instance by shell or Gradle script.

The problem is, the name of Chrome User (Katalon) and the name of Profile directory (‘Profile x’) is varying; I want to find how a method to find the Profile directory with Chrome User name as key by script, without human intervention. — I can not find the method yet.

So, a possible opposite approach is to always use the Chrome Profile directory Default on EC2 instance and dont mind User name. — But another problem occurs. if I run this test suite on my daly-use PC, the Default profile directory will be overwritten by test fixture; this causes my daily-use Chrome be uncomforable.

The new post by @ Brandon_Hein gave me a clue.

In my Chrome, I made a new proflile named Katalon. My problem was finding out which directory under the C:\Users\<MyOsUserName>\AppData\Local\Google\Chrome\User Data is linked to the new Katalon profile.

In the directory, I found 3 profile directores which contains Preferences file.

  • Default\Preferences
  • Profile 1\Preferences
  • Profile 2\Preferences

I look into all Preferences files, and found the Profile 2/Preferences file contains the following code:

    "profile": {
        "name": "Katalon",

OK。Now I got it。All I need to do is as follows:

  1. locate the Chrome’s User Data directory: C:\Users\<MyOsUserName>\AppData\Local\Google\Chrome\User Data
  2. identify the name of Profile in question: Katalon
  3. search the User Data directory to look up subdirectories which contain a child Preferences file
  4. parse the Preferences file, select the value of /profile/name node in the json. If the value of /profile/name is equal to the Profile name in question (Katalon), then the directory is the one I want
  5. now I know the Profile directory I want is C:\Users\<MyOsUserName>\AppData\Local\Google\Chrome\User Data\<X>

This algorithm resolves the Profile name (Katalon) -> the Directory name (X) deterministically.

I would implement this as a Custom Keyword.


Hi Thanh,

Thanks for this - it’s a big help. I’m able to launch chrome with the correct profile, but I’m running into an error caused by this line:
WebDriver driver = new ChromeDriver(chromeProfile);


org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /Applications/Google Chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

Any insight into what might be causing this? Is it a versioning issue? The chrome profile I'm using is up to date (72.0.3626.121). I have noticed that I don't get this error if I kill all chrome processes before running (but of course that's not optimal). Any help would be greatly appreciated. 



Hi @wil.fifer

It seems to be an issue with Selenium Web Driver itself according to this opened issue:

If you really want to get around it, then please try one of the suggestions there.

Regards !

Regards !

As suggested by PascalGit1, the following approach worked for me.

ChromeOptions ChromeOptions = new ChromeOptions();
ChromeOptions.addArguments("--headless", "window-size=1024,768", "--no-sandbox");
driver = new ChromeDriver(ChromeOptions);

It seems that the option --headless is significant. When i removed --headless, the problem comes up.

Specifying --healeass makes my Chrome headless; I can not view the Chrome window any longer. This is not very much satisfactory. Still I want to find out a way to work around the “DevToolsActivePort file is missing” problem while keeping the Chrome window to be visible. I will continue researching a bit more.

As for

this problem, in the discussion, the following was mentioned.

this can be caused by using a Chromedriver which does not support the version of the installed Chrome. This can happen, for example, if chrome is upgraded without upgrading Chromedriver. – expz Nov 29 '18 at 21:12

It implies, that the chromedirver bundled in the Katalon Studio might be too old to work with the current version of Google Chrome.

OK, let me check it.

My Environment

OS: Windows 7
Katalon Studio version : 6.0.6 beta
chromedriver version: 2.43.600210
Chrome browser version: 72.0.3626.121


Chrome Driver’s documentation says

If you are using Chrome version 72, please download ChromeDriver 2.46 or ChromeDriver 72.0.3626.69"


I downloaded the Chrome Driver 2.46 and installed into the Katalon Studio’s directory. I tried my test and found that the “DevToolsActivePort file doesn’t exist” problem disappeared.


The chromedrivers bundled in Katalon Studio 6.0.6 should be updated to the current releases.

I could successfully developed a set of Groovy classes named webdriverfactory4ks. This library enables me to launch Groogle Chrome browser specifying a Custom Profile name. You can use it as follows:

import com.kazurayam.ksbackyard.webdriver.ChromeDriverFactory
	void test_openChromeDriver() {
		ChromeDriverFactory cdFactory = new ChromeDriverFactory()
		WebDriver driver = cdFactory.openChromeDriverWithProfile('Katalon')   // Katalon is a Profile name
		assertThat(driver, is(notNullValue()))

This code set worked OK.

I would share the code later.

This code set involves a few Groovy classes, so it should be archived into a *.jar for sharing class files. The Katalon Plugin mechanism is still being developed, and would requires a few weeks to come.

edited 12/March/2019

I have published the webdriverfactory4ks-all.jar on GitHub.


Hi Thanh!
Thanks , It worked. But should we really need to provide the

// Here you specify the actual profile folder (Profile 2)
chromeProfile.addArguments("profile-directory=Profile 2");

above line . because in selenium with eclipse we can directly provide the profile directory like

String chromeProfilePath = “C:\Users\thanhto\AppData\Local\Google\Chrome\User Data\Profile 2”;

wouldn’t that possible here?

What if a custom profile created need to run via Chrome headless Browser.

I tried Running the same script its working fine for normal chrome, when i used the same with Profile its opening the chrome.

Hey ThanhTo, thanks much for this code, although I’m able to successfully launch the Chrome browser with a new custom profile, Katalon is displaying the following failure:
org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.

The only change I made to your code was the pathToChromeDriver, I’m using my chrome executalbe at C: Program Files …, but that shouldn’t be causing this error, right??

I keep getting this from the above code - please be gentle with me I am very very new to this and in the process of teaching myself.

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
file:/C:/Users/deric/Katalon%20Studio/TN/TrueNorth/Scripts/TrueNorth/TNGTCLogin/Script1636153465987.groovy: 26: unable to resolve class ChromeOptions
@ line 26, column 15.
ChromeOptions chromeProfile = new ChromeOptions();

file:/C:/Users/deric/Katalon%20Studio/TN/TrueNorth/Scripts/TrueNorth/TNGTCLogin/Script1636153465987.groovy: 26: unable to resolve class ChromeOptions
@ line 26, column 31.
ChromeOptions chromeProfile = new ChromeOptions();

file:/C:/Users/deric/Katalon%20Studio/TN/TrueNorth/Scripts/TrueNorth/TNGTCLogin/Script1636153465987.groovy: 31: unable to resolve class WebDriver
@ line 31, column 11.
WebDriver driver = new ChromeDriver(chromeProfile);

file:/C:/Users/deric/Katalon%20Studio/TN/TrueNorth/Scripts/TrueNorth/TNGTCLogin/Script1636153465987.groovy: 31: unable to resolve class ChromeDriver
@ line 31, column 20.
WebDriver driver = new ChromeDriver(chromeProfile);

Please can you help - all I want is to open chrome with the default profile.
there is an option to launch Chrome (with profile) but it is only available in the web recorder for some reason. and it does not work - it does not open chrome with my normal profile and settings and extensions , still just opens a blank chrome in dark mode with no profile or extensions

you need to add two import statements:

import org.openqa.selenium.WebDriver

Thanks @ThanhTo It worked. Although am able to open the browser with a custom profile, its showing below error
com.kms.katalon.core.webui.exception.BrowserNotOpenedException: Browser is not opened

Looks like am getting error in the below code :
WebDriver webDriver = DriverFactory.changeWebDriver(driver)

Its underlined