How to execute katalon studio's test suite on google chrome with custom chrome profile

How to execute katalon studio’s test suite on google chrome with custom chrome profile?

My website uses OTP to login, so I decided to use custom chrome profile to my test case. In order to execute my test suite, I need to close all the other active browsers. So, when I try to execute data driven testing in test suite, after the 1st successful test the browser creates new window to execute 2nd test. But I need browser to close after the 1st test, then opens new window to complete successful data driven test. How to make this happen?

1 Like

Katalon Studio does not offer any built-in solution to your requirement.

You need a custom solution. Here is mine:

You need to download the chromedriverfactory-0.6.6.jar from Release Granting JavaScript for Access to Clipboard · kazurayam/chromedriverfactory · GitHub and locate it in the Drivers folder of a Katlaon project.

Please be informed that you no longer use the WebUI.openBrowser() keyword to launch Chrome browser.

Instead, you want to call the API of the chromedriverfactory library directly to get an instance of `org.openqa.selenium.WebDriver’ to start a Chrome browser with custom user profile.

And you would want to do like this:

ChromeDriverFactory factory = ChromeDriverFactory.newChromeDriverFactory()
LaunchedChromeDriver launched = factory.newChromeDriver(
                new UserProfile("Picasso"),
                ChromeDriverFactory.UserDataAccess.TO_GO)
WebDriver driver = launched.getDriver()
...
DriverFactory.changeWebDriver(driver)
WebUI.navigateToUrl("http://example.com")
...

A call to DriverFactory.changeWebDriver(driver) is important. It will enable you to use WebUI.* keywords via the Chrome browser with a custom user profile.

1 Like