Katalon/Docker: Build custom image with latest chrome browser and chrome driver

Hi,

I am facing an issue related with chrome browser version. I have some test cases that run correctly from the Katalon Studio on the local machine where chrome browser is 96.x

I run the same test cases from a Katalon container and they are failing. I use the latest Katalon image where chrome browserVersion: 92.0.4515.159, chromedriverVersion: 92.0.4515.43.

I guess the version of chrome could be related. I also tried to use the option
--config -webui.autoUpdateDrivers=true in my docker command but from the log it doesn’t seem to update the chrome browser neither driver as it’s still the version 92.x

I want to update the chrome browser and chrome driver to the latest in the Katalon image. For that I want to build a custom image of Katalon with latest chrome. I’ve searched few tuto and start running a container with the latest Katalon image and see if I can update the chromes there and save the new image.
But I got an error when I try to run

docker run -it katalonstudio/katalon

ErrorLog
PS C:\Users\ngphu> docker run -it katalonstudio/katalon
+ echo Entrypoint
Entrypoint
+ '[' -z '' ']'
+ exec /bin/sh -c '$KATALON_KATALON_SCRIPT_DIR/katalon-notify.sh'
/bin/sh: 1: /katalon-notify.sh: not found

It’s not possible to run a Katalon container standalone?

Anyone has experience of building custom image of Katalon with latest chrome browser + driver?

Thanks for your help.

you have to provide an argument to this (a comand to run)

try:
docker run -it katalonstudio/katalon bash
that should create a temporary container and gave to you access to the bash shell inside

however, to build a custom image, first you need to read this:

you have to create first a docker file, using the katalon image as a source and then build it

you can read a bit also here:

Thanks @anon46315158 for your help. I can run the Katalon container now.
In meantime I already followed instruction from the katalon github to try to build a custom image. Below my Dockerfile

Dockerfile
FROM katalonstudio/katalon

# Install dependencies.
RUN apt-get update

# Install Chrome.
RUN curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add
RUN echo "deb https://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list
RUN apt-get -y install google-chrome-stable

# Install ChromeDriver.
RUN wget -N https://chromedriver.storage.googleapis.com/96.0.4664.45/chromedriver_linux64.zip -P ~/
RUN unzip ~/chromedriver_linux64.zip -d ~/
RUN rm ~/chromedriver_linux64.zip
RUN mv -f ~/chromedriver ls -/chromedriver
RUN chown root:root /opt/katalonstudio/configuration/resources/drivers/chromedriver_linux64/chromedriver
RUN chmod 0755 /opt/katalonstudio/configuration/resources/drivers/chromedriver_linux64/chromedriver

I built that image and ran my test cases with it but got an error

ErrorLog
Caused by: org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: '1ab5da63ec25', ip: 'x.x.x.x', os.name: 'Linux', os.arch: 'amd64', os.version: '5.4.72-microsoft-standard-WSL2', java.version: '1.8.0_292'
Driver info: driver.version: CChromeDriver
remote stacktrace: #0 0x562116234ee3 <unknown>

I’ve checked the google chrome browser in the image and its version is 96.0.4664.45. The chrome driver is also the latest and placed in the correct folder.

Is there anything I did wrong in my Dockerfile? Or something is still missing?

I managed to build a custom katalon image based on the latest Katalon image where I updated chrome browser and driver to latest version. But my test is still failing

ErrorLog
Caused by: org.openqa.selenium.NoSuchSessionException: invalid session id
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: '92f2cd6faf03', ip: 'x.x.x.x', os.name: 'Linux', os.arch: 'amd64', os.version: '5.4.72-microsoft-standard-WSL2', java.version: '1.8.0_292'
Driver info: com.kms.katalon.selenium.driver.CChromeDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 96.0.4664.45, chrome: {chromedriverVersion: 96.0.4664.45 (76e4c1bb2ab46..., userDataDir: /tmp/.com.google.Chrome.1uSvaZ}, goog:chromeOptions: {debuggerAddress: localhost:39777}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: LINUX, platformName: LINUX, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true}

As you can see in the error log, the chrome broser and driver are both version 96.x but the error is still there.
I wonder if the version of Katalon 8.1.0 (from latest image) is not supporting latest version of Chrome.

Any thought?

you can try 8.2.0, see the release notes:

Not sure about 96, but chrome 95 should work out of the box.

Thanks @anon46315158 for the update about version 8.2.0
I tried that version and indeed chrome browser version is browserVersion: 96.0.4664.45, chrome: {chromedriverVersion: 96.0.4664.45
but the error is still there

ErroLog
Cannot take screenshot (Root cause: com.kms.katalon.core.exception.StepFailedException: Cannot take screenshot
	at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)
	at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:26)
	at com.kms.katalon.core.webui.keyword.builtin.TakeFullPageScreenshotKeyword.takeScreenshot(TakeFullPageScreenshotKeyword.groovy:125)
	at com.kms.katalon.core.webui.keyword.builtin.TakeFullPageScreenshotKeyword.execute(TakeFullPageScreenshotKeyword.groovy:82)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:74)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.takeFullPageScreenshot(WebUiBuiltInKeywords.groovy:3225)
	at generalKeyword.GeneralKeyword.takeFullPageScreenshot(GeneralKeyword.groovy:111)
	at generalKeyword.GeneralKeyword.invokeMethod(GeneralKeyword.groovy)
	at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:50)
	at 117_register_user_with_password_of_99_characters.run(117_register_user_with_password_of_99_characters:154)
	at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
	at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
	at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:430)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:421)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:400)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:392)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:273)
	at com.kms.katalon.core.main.TestSuiteExecutor.accessTestCaseMainPhase(TestSuiteExecutor.java:202)
	at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(TestSuiteExecutor.java:164)
	at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:105)
	at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:185)
	at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
	at TempTestSuite1637237342036.run(TempTestSuite1637237342036.groovy:36)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
	at com.assertthat.selenium_shutterbug.utils.web.Browser.sendCommand(Browser.java:678)
	at com.assertthat.selenium_shutterbug.utils.web.Browser.takeFullPageScreenshotChromeCommand(Browser.java:549)
	at com.assertthat.selenium_shutterbug.utils.web.Browser.takeFullPageScreenshot(Browser.java:150)
	at com.assertthat.selenium_shutterbug.core.Shutterbug.shootPage(Shutterbug.java:154)
	at com.assertthat.selenium_shutterbug.core.Shutterbug.shootPage(Shutterbug.java:83)
	at com.assertthat.selenium_shutterbug.core.Shutterbug.shootPage(Shutterbug.java:69)
	at com.kms.katalon.core.webui.util.FileUtil.takeFullPageScreenshot(FileUtil.java:86)
	at com.kms.katalon.core.webui.keyword.builtin.TakeFullPageScreenshotKeyword$_takeScreenshot_closure1.doCall(TakeFullPageScreenshotKeyword.groovy:126)
	at com.kms.katalon.core.webui.keyword.builtin.TakeFullPageScreenshotKeyword$_takeScreenshot_closure1.call(TakeFullPageScreenshotKeyword.groovy)
	at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
	at com.kms.katalon.core.webui.keyword.builtin.TakeFullPageScreenshotKeyword.takeScreenshot(TakeFullPageScreenshotKeyword.groovy:125)
	at com.kms.katalon.core.webui.keyword.builtin.TakeFullPageScreenshotKeyword.execute(TakeFullPageScreenshotKeyword.groovy:82)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:74)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.takeFullPageScreenshot(WebUiBuiltInKeywords.groovy:3225)
	at generalKeyword.GeneralKeyword.takeFullPageScreenshot(GeneralKeyword.groovy:111)
	at generalKeyword.GeneralKeyword.invokeMethod(GeneralKeyword.groovy)
	at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:50)
	at Script1635323929739.run(Script1635323929739.groovy:154)
	... 13 more
Caused by: java.lang.reflect.InvocationTargetException
	at com.assertthat.selenium_shutterbug.utils.web.Browser.sendCommand(Browser.java:675)
	... 30 more
Caused by: org.openqa.selenium.WebDriverException: unknown error: session deleted because of page crash
from unknown error: cannot determine loading status
from tab crashed
  (Session info: chrome=96.0.4664.45)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: '92f2cd6faf03', ip: 'x.x.x.x', os.name: 'Linux', os.arch: 'amd64', os.version: '5.4.72-microsoft-standard-WSL2', java.version: '1.8.0_292'
Driver info: com.kms.katalon.selenium.driver.CChromeDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 96.0.4664.45, chrome: {chromedriverVersion: 96.0.4664.45 (76e4c1bb2ab46..., userDataDir: /tmp/.com.google.Chrome.1uSvaZ}, goog:chromeOptions: {debuggerAddress: localhost:39777}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: LINUX, platformName: LINUX, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true}
Session ID: 52c3a5b334a75ca8a96532219114a678
	at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
	at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
	at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
	at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
	at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
	at com.kms.katalon.selenium.driver.CChromeDriver.execute(CChromeDriver.java:19)
	... 31 more
)                             	
Cannot take screenshot (Root cause: com.kms.katalon.core.exception.StepFailedException: Cannot take screenshot
	at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)
	at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:26)
	at com.kms.katalon.core.webui.keyword.builtin.TakeFullPageScreenshotKeyword.takeScreenshot(TakeFullPageScreenshotKeyword.groovy:125)
	at com.kms.katalon.core.webui.keyword.builtin.TakeFullPageScreenshotKeyword.execute(TakeFullPageScreenshotKeyword.groovy:82)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:74)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.takeFullPageScreenshot(WebUiBuiltInKeywords.groovy:3225)
	at generalKeyword.GeneralKeyword.takeFullPageScreenshot(GeneralKeyword.groovy:113)
	at generalKeyword.GeneralKeyword.invokeMethod(GeneralKeyword.groovy)
	at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:50)
	at 117_register_user_with_password_of_99_characters.run(117_register_user_with_password_of_99_characters:154)
	at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
	at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
	at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:430)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:421)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:400)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:392)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:273)
	at com.kms.katalon.core.main.TestSuiteExecutor.accessTestCaseMainPhase(TestSuiteExecutor.java:202)
	at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(TestSuiteExecutor.java:164)
	at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:105)
	at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:185)
	at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
	at TempTestSuite1637237342036.run(TempTestSuite1637237342036.groovy:36)
Caused by: org.openqa.selenium.NoSuchSessionException: invalid session id
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: '92f2cd6faf03', ip: 'x.x.x.x', os.name: 'Linux', os.arch: 'amd64', os.version: '5.4.72-microsoft-standard-WSL2', java.version: '1.8.0_292'
Driver info: com.kms.katalon.selenium.driver.CChromeDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 96.0.4664.45, chrome: {chromedriverVersion: 96.0.4664.45 (76e4c1bb2ab46..., userDataDir: /tmp/.com.google.Chrome.1uSvaZ}, goog:chromeOptions: {debuggerAddress: localhost:39777}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: LINUX, platformName: LINUX, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true}
Session ID: 52c3a5b334a75ca8a96532219114a678
	at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
	at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
	at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
	at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
	at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
	at com.kms.katalon.selenium.driver.CChromeDriver.execute(CChromeDriver.java:19)
	at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:489)
	at org.openqa.selenium.support.events.EventFiringWebDriver.lambda$new$1(EventFiringWebDriver.java:105)
	at com.sun.proxy.$Proxy20.executeScript(Unknown Source)
	at org.openqa.selenium.support.events.EventFiringWebDriver.executeScript(EventFiringWebDriver.java:229)
	at com.assertthat.selenium_shutterbug.utils.web.Browser.executeJsScript(Browser.java:668)
	at com.assertthat.selenium_shutterbug.utils.web.Browser.<init>(Browser.java:83)
	at com.assertthat.selenium_shutterbug.core.Shutterbug.shootPage(Shutterbug.java:139)
	at com.assertthat.selenium_shutterbug.core.Shutterbug.shootPage(Shutterbug.java:83)
	at com.assertthat.selenium_shutterbug.core.Shutterbug.shootPage(Shutterbug.java:69)
	at com.kms.katalon.core.webui.util.FileUtil.takeFullPageScreenshot(FileUtil.java:86)
	at com.kms.katalon.core.webui.keyword.builtin.TakeFullPageScreenshotKeyword$_takeScreenshot_closure1.doCall(TakeFullPageScreenshotKeyword.groovy:126)
	at com.kms.katalon.core.webui.keyword.builtin.TakeFullPageScreenshotKeyword$_takeScreenshot_closure1.call(TakeFullPageScreenshotKeyword.groovy)
	at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
	at com.kms.katalon.core.webui.keyword.builtin.TakeFullPageScreenshotKeyword.takeScreenshot(TakeFullPageScreenshotKeyword.groovy:125)
	at com.kms.katalon.core.webui.keyword.builtin.TakeFullPageScreenshotKeyword.execute(TakeFullPageScreenshotKeyword.groovy:82)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:74)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.takeFullPageScreenshot(WebUiBuiltInKeywords.groovy:3225)
	at generalKeyword.GeneralKeyword.takeFullPageScreenshot(GeneralKeyword.groovy:113)
	at generalKeyword.GeneralKeyword.invokeMethod(GeneralKeyword.groovy)
	at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:50)
	at Script1635323929739.run(Script1635323929739.groovy:154)
	... 13 more
) 

I don’t know if it’s a bug in Katalon or a full page screenshot is the problem.

well… i think this is the time for you to share the code you are running and eventualy the targeted page, if you need further help

Thanks @anon46315158 for your help. Very appreciated.
However my investigation can’t lead to a proper solution. I have a custom image with the version 96.0.4664.45 for chrome browser and chromedriver same as my local machine setup. But still have error when taking screenshot.

The weird thing is the keyword that performs screenshot action is working in other case and even in the test case where it’s failing. In the test cases where the screenshot is failing, it happens when it’s taking a screenshot of a page where there is a vertical scroll bar. It’s the only different I can tell so far. Don’t know if it could be somehow related with my issue.
Anyway I am reporting an issue to Katalon and see if they will have more clues.

For people who searching how to build a custom image of Katalon with latest version of chrome browser and driver. I put below my Dockerfile

Dockerfile
FROM katalonstudio/katalon:latest

# common environment variables
ARG KATALON_ROOT_DIR=/katalon
ARG KATALON_BASE_ROOT_DIR=$KATALON_ROOT_DIR/base
ENV KATALON_VERSION_FILE=$KATALON_ROOT_DIR/version
ENV KATALON_SOFTWARE_DIR=/opt

ARG KATALON_KATALON_SCRIPT_DIR=$KATALON_ROOT_DIR/scripts
ENV PATH "$PATH:$KATALON_KATALON_SCRIPT_DIR"
ENV KATALON_KATALON_ROOT_DIR=$KATALON_ROOT_DIR/katalon

ARG CHROMEDRIVER_VERSION

# Copy "wrap_chrome_binary" script
WORKDIR $KATALON_BASE_ROOT_DIR
COPY ./katalon-docker-scripts/wrap_chrome_binary.sh wrap_chrome_binary.sh
RUN chmod a+x wrap_chrome_binary.sh

# Copy script to install Chrome
WORKDIR $KATALON_KATALON_SCRIPT_DIR
COPY ./katalon-docker-scripts/setup.sh setup.sh
RUN chmod a+x setup.sh

# Main setup
# -> install chrome browser
# -> install chrome driver
RUN $KATALON_KATALON_SCRIPT_DIR/setup.sh

# set work directory at /
WORKDIR /

I built my Dockerfile based on the official Katalon github page here

  • script wrap_chrome_binary.sh is from katalon github
  • script setup.sh is from katalon github where I let only command to install chrome browser and chromedriver

Hope it can help someone else :slight_smile:

For the moment we put a work around in place to catch the exception of the screenshot and to not fail the test case.

Hi can you help me in building the katalon custom docker image with browser version for chrome 112