# Starting Chrome with specific user profile

**URL:** <https://forum.katalon.com/t/starting-chrome-with-specific-user-profile/13377>\
**Category:** Web Testing\
**Tags:** chrome\
**Created:** [September 24, 2018, 5:13pm UTC](https://forum.katalon.com/t/starting-chrome-with-specific-user-profile/13377 "2018-09-24T17:13:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luc\_Benichou](https://avatars.discourse-cdn.com/v4/letter/l/7feea3/32.png) [@Luc\_Benichou](https://forum.katalon.com/u/Luc_Benichou)\
**Post date:** [September 24, 2018, 5:13pm UTC](https://forum.katalon.com/t/starting-chrome-with-specific-user-profile/13377/1 "2018-09-24T17:13:58Z")

</div>

Hi All,

We would like to run a script launching Chrome with a specific user profile, to be able to use saved password and other cookies.  
My understanding is that the below code should doit, but Katalon still kicks a Chrome with a new user profile :

```auto
import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import internal.GlobalVariable as GlobalVariable
import org.openqa.selenium.Keys
import org.openqa.selenium.WebDriver
import org.openqa.selenium.chrome.ChromeOptions
import org.openqa.selenium.chrome.ChromeDriver
import com.kms.katalon.core.webui.driver.DriverFactory
System.setProperty('webdriver.chrome.driver', "/Applications/Katalon Studio.app/Contents/Eclipse/configuration/resources/drivers/chromedriver_mac/chromedriver")
System.setProperty('webdriver.chrome.logfile', '/Users/user1/Temp/chromedriver_TC.log')
def chromeBinaryPath = '/Applications/Google Chrome.app/Contents/MacOSocal/Google/Chrome/Google Chrome'
ChromeOptions options = new ChromeOptions()
options.addArguments("user-data-dir=/Users/user1/Library/Application Support/Google/Chrome/Default")
WebDriver driver = new ChromeDriver(options)
DriverFactory.changeWebDriver(driver)
WebUI.openBrowser('')

```

Would you have some idea how to fix that?

Thx

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [September 24, 2018, 10:03pm UTC](https://forum.katalon.com/t/starting-chrome-with-specific-user-profile/13377/2 "2018-09-24T22:03:40Z")

</div>

Similar discussion is here:

- [Unknown error: cannot find Chrome binary](http://forum.katalon.com/t/unknown-error-cannot-find-chrome-binary/9008)

---

<div class="post-metadata">

**Author:** ![Luc\_Benichou](https://avatars.discourse-cdn.com/v4/letter/l/7feea3/32.png) [@Luc\_Benichou](https://forum.katalon.com/u/Luc_Benichou)\
**Post date:** [September 25, 2018, 10:32am UTC](https://forum.katalon.com/t/starting-chrome-with-specific-user-profile/13377/3 "2018-09-25T10:32:33Z")

</div>

Hi Kazurayam,

Ok, the discussion given there simplify the code and set the browser path in the settings. Thx

But chrome is still opened with a temporary user profile.  
In http://forum.katalon.com/discussion/2515/how-can-i-open-chrome-with-8211disable-web-security-8211user-data-dircmydata a solution is given but does not seem to work on MACOS :  
(user1 is the default profile)

> [1537870769.482][INFO]: COMMAND InitSession {  
> “capabilities”: {  
> “desiredCapabilities”: {  
> “browserName”: “chrome”,  
> “chrome.binary”: “/Applications/Google Chrome.app/Contents/MacOSocal/Google/Chrome/Google Chrome”,  
> “goog:chromeOptions”: {  
> “args”: [“chrome.switches”, “–disable-extensions”],  
> “prefs”: {  
> “–user-data-dir”: “/Users/user1/Library/Application Support/Google/Chrome”,  
> “profile-directory”: “Default”  
> }  
> },

> ```auto
> [1537870769.488][INFO]: Launching chrome: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome --chrome.switches--disable-background-networking --disable-client-side-phishing-detection --disable-default-apps --disable-extensions --disable-extensions-except=/var/folders/st/_59xddp90kg6s61tl7fbnpz40000gn/T/.org.chromium.Chromium.v3P84h/internal --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-web-resources --enable-automation --enable-logging --force-fieldtrials=SiteIsolationExtensions/Control --ignore-certificate-errors --log-level=0 --metrics-recording-only --no-first-run --no-proxy-server --password-store=basic --remote-debugging-port=12247 --test-type=webdriver --use-mock-keychain --user-data-dir=/var/folders/st/_59xddp90kg6s61tl7fbnpz40000gn/T/.org.chromium.Chromium.bUGXP0 data:,
> 
> ```

the --user-data-dir is overwritten at launch

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [September 25, 2018, 9:53pm UTC](https://forum.katalon.com/t/starting-chrome-with-specific-user-profile/13377/4 "2018-09-25T21:53:05Z")

</div>

You should not call “WebUI.openBrowser(’’)” at all. Just delete the last line in your test case script, and try again.

```auto
...WebDriver driver = new ChromeDriver(options)DriverFactory.changeWebDriver(driver)// WebUI.openBrowser('')

```

… “new ChromeDriver(options)” will start the Chrome browser. You do not need to call WebUI.openBrowser(’’). If you call it, then one more Chrome browser gets started and logged — this action is confusing you, I suppose.
