Starting Chrome with specific user profile

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 :

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

Similar discussion is here:

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”
}
},

[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

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

...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.