WebUI to pass chromeOptions

Hi All,

I am facing an issue related to setting my chrome Profile in Katalon Studio. I am able to do it in code using ChromeOptions . The code is as follows:
System.setProperty(“webdriver.chrome.driver”, “C:\Users\ChandMehta.katalon\packages\Katalon_Studio_Windows_64-9.0.0\Katalon_Studio_Windows_64-9.0.0\configuration\resources\drivers\chromedriver_win32\chromedriver.exe”)

ChromeOptions chromeProfile = new ChromeOptions()

chromeProfile.addArguments(“user-data-dir=” + “C:\Users\ChandMehta\AppData\Local\Google\Chrome\User Data\”)
chromeProfile.addArguments(“profile-directory=Default”)

WebDriver driver = new ChromeDriver(chromeProfile)
DriverFactory.changeWebDriver(driver)

WebUI.navigateToUrl(“https://gmail.com”)

But when I want to run tests in continuity, it does not save my session since it is using DriverFactory instead of normal WebUI.openBrowser.

So my concern is: Is there an option to use WebUI to pass chromeOptions like user-data-dir and profile-directory. Or use Desired Capabilities like this:

{“CHROME_DRIVER”:{“prefs”:{“user-data-dir”:“C:\Users\ChandMehta\AppData\Local\Google\Chrome\User Data\”,“profile-directory”:“Default”}}}

Is the above setting correct? As if I am using it, it is not setting my profile to Default.

1 Like

What do you mean by saying “it does not save my session”? What did you expect to see? What did you actually see? Please describe phenomenons you experienced with more detail information.

Are you aware that Gmail is an extremely difficult target for Selenium-based automation tools? Does the screenshot below depict your current problem?

To work with Gmail in Katalon Studio, you need to study a lot. See

and

I suppose you now have 2 questions unresolved.

  1. You want to take over session information (Cookies, Local Storage, etc) from one session to another via Chrome Profile.

  2. You want to work with Gmail.

I would recommend you to address the issues one by one. You should not work on these 2 issues at the same time.

I mean, you should not involve Gmail as a testbed for the 1st issue. You shouldn’t take Gmail lightly. You should use some other URL easier to debug the first issue. If I were you, I would make a simple local HTTP server that feeds a cookie as I want so that I can debug my test code for the 1st issue.

2 Likes