I have developed a Groovy class that quickly enables users to use Chrome for Testing in their test cases in Katalon Studio.
See the Github repository at
Problem to solve
As of the 3rd week February 2024, in Katalon Studio, the “Tools > Update WebDriver > Chrome” failed. See http://forum.katalon.com/t/chrome-failed-to-start-exited-normally/119718/17 for the reason why. Consequently I could not run any test cases in Katalon Studio using Chrome browser.
Solution
I will use “Chrome for Testing” instead of Chrome browser.
“Chrome for Testing” is a flavor of Chrome brower. It was released in July 2023. It has a special characteristic: it does not auto-upgrade itself. I can keep the “Chrome for Testing” and the associated ChromeDriver fixed to a certain version that I choose. With “Chrome for Testing”, I would no longer be disturbed by the frequent upgrades of Chrome and unstable downloads of ChromeDriver. Of course, I can upgrade the version manually when I want to.
Solution explained
Installing Chrome for Testing and ChromeDriver of the version
See the blog for detail. You need “Node” and “npx” installed on your machine (I suppose that all of serious Web developers would have installed Node already).
To install a specific version of “Chrome for Testing”, run the command
$ npx @puppeteer/browsers install chrome@116.0.5793.0
To install the corresponding version of “ChromeDriver”, run the command
$ npx @puppeteer/borwsers install chromedriver@116.0.5793.0
The above demo installs an old version 116.0.5793.0. This is just an example. You can specify any available version in the command line. You can find more detail about the npx @puppeteer/browsers command at the doc page.
How to find the list of available versions? — You can check the most recent available versions at Chrome for Testing availability . As of 25 Feb 2024, this page showed the following image:
The Chrome developers maintains this list up to date.
If you don’t like to be asked to specify a concrete version number, you can do as follows:
$ npx @puppeteer/browsers install chrome@latest
Downloading chrome r123.0.6312.10 - 165 MB [====================] 100% 0.0s
chrome@123.0.6312.10 /Users/kazurayam/chrome/mac-123.0.6312.10/chrome-mac-x64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing
and
$ npx @puppeteer/browsers install chromedriver@latest
Downloading chromedriver r123.0.6312.10 - 9.3 MB [==================] 100% 0.0s
chromedriver@123.0.6312.10 /Users/kazurayam/chromedriver/mac-123.0.6312.10/chromedriver-mac-x64/chromedriver
It is up to you which version to use.
Create a custom Groovy class
I developped 2 groovy codes in the Include/scripts/groovy folder:
The Installation class contains the information in which path you installed the binaries of the “Chrome for Testing” and the ChromeDriver. The code must be customized by you. You are responsible to code the Installation class so that you specify the path information of the binaries you want to use.
The ChromeForTestingDriverFactory class is just reusable, I meant.
Test Case example that uses “Chrome for Testing”
See TC1
Let me copy&paste the source here:
import org.openqa.selenium.WebDriver
import com.kazurayam.ks.driver.chrome4testing.ChromeForTestingDriverFactory
import com.kazurayam.ks.driver.chrome4testing.Installation
import com.kms.katalon.core.webui.driver.DriverFactory
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
ChromeForTestingDriverFactory driverFactory =
new ChromeForTestingDriverFactory(Installation.mac_116_0_5793_0_mac_x64)
WebDriver driver = driverFactory.newChromeForTestingDriver()
DriverFactory.changeWebDriver(driver)
WebUI.navigateToUrl("http://demoaut.katalon.com/")
WebUI.delay(3)
WebUI.closeBrowser()
This test case will run using Chrome for Testing version 116.0.5793.0.
Please note that your Test Case script MUST NOT call WebUI.openBrowser(). The call to driverFactory.newChromeForTestingDriver() will open a window of Chrome for Testing. So no need to duplicate a call to WebUI.openBrowser().
Headless mode
You can open Chrome for Testing in Headless mode. See the code

