Running Chrome from Katalon (Linux)

I am running Katalon on a Debian Linux system (Debian 4.17.17-1 (2018-08-18) x86_64). All my tests are failing, apparently because Katalon is unable to launch Chrome. I suspect that katalon doesn’t know where to find Chrome. Can anyone tell me how to configure this?

Here is the command I’m using to run Katalon.

/home/userx/katalon/katalon --args -noSplash  -runMode=console -consoleLog -retry=0 -executionProfile="default" -browserType="Chrome (headless)" -projectPath="/home/userx/myproject/Tests/Tests.prj" -testSuitePath="Test Suites/List"

And here is an abbreviated version of the output I get:

Request sent successfully.
!SESSION 2018-09-18 17:34:25.242 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.8.0_171
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments:  --args -runMode=console -retry=0 -executionProfile=default -browserType=Chrome (headless) -projectPath=/home/richard/as1mark/submissions/2-processing/As1Tests/As1Tests.prj -testSuitePath=Test Suites/List
Command-line arguments:  -os linux -ws gtk -arch x86_64 -data config --args -runMode=console -consoleLog -retry=0 -executionProfile=default -browserType=Chrome (headless) -projectPath=/home/richard/as1mark/submissions/2-processing/As1Tests/As1Tests.prj -testSuitePath=Test Suites/List
!ENTRY org.eclipse.core.resources 2 10035 2018-09-18 17:34:28.854
!MESSAGE The workspace exited with unsaved changes in the previous session; refreshing workspace to recover changes.
Starting Groovy-Eclipse compiler resolver.  Specified compiler level: unspecified
150 2.4.7.xx-201611170128-e46 = ACTIVE
--------------------------------------------------------------------------------
Test Suites/List - Chrome (headless) - 20180918_173432...................0/7(0%)
--------------------------------------------------------------------------------
Request sent successfully.
09-18-2018 05:34:35 PM - [START]  - Start Test Suite : Test Suites/List
09-18-2018 05:34:35 PM - [RUN_DATA] - Logging run data 'hostName' with value 'userx - userx.redacted.com'
09-18-2018 05:34:35 PM - [RUN_DATA] - Logging run data 'os' with value 'Linux 64bit'
09-18-2018 05:34:35 PM - [RUN_DATA] - Logging run data 'hostAddress' with value '10.0.106.93'
09-18-2018 05:34:35 PM - [RUN_DATA] - Logging run data 'katalonVersion' with value '5.7.1.1'
09-18-2018 05:34:35 PM - [START]  - Start Test Case : Test Cases/3.list-view/a-TotalRows
09-18-2018 05:34:35 PM - [INFO]   - Evaluating variables for test case
09-18-2018 05:34:35 PM - [START]  - Start setup action : setupTestCase
09-18-2018 05:34:36 PM - [START]  - Start action : openBrowser
09-18-2018 05:34:36 PM - [END]    - End action : openBrowser
09-18-2018 05:34:36 PM - [ERROR]  - java.lang.ExceptionInInitializerError
09-18-2018 05:34:36 PM - [END]    - End End action : setupTestCase
09-18-2018 05:34:36 PM - [ERROR]  - 
09-18-2018 05:34:36 PM - [END]    - End Test Case : Test Cases/3.list-view/a-TotalRows
09-18-2018 05:34:36 PM - [START]  - Start Test Case : Test Cases/3.list-view/b-AllFields
09-18-2018 05:34:36 PM - [INFO]   - Evaluating variables for test case
09-18-2018 05:34:36 PM - [START]  - Start setup action : setupTestCase
09-18-2018 05:34:36 PM - [START]  - Start action : openBrowser
09-18-2018 05:34:36 PM - [END]    - End action : openBrowser
09-18-2018 05:34:36 PM - [ERROR]  - java.lang.NoClassDefFoundError: Could not initialize class com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword
09-18-2018 05:34:36 PM - [END]    - End End action : setupTestCase
09-18-2018 05:34:36 PM - [ERROR]  - 
09-18-2018 05:34:36 PM - [END]    - End Test Case : Test Cases/3.list-view/b-AllFields
[Removed lots of unhelpful lines here]--------------------------------------------------------------------------------
Test Suites/List - Chrome (headless) - 20180918_173432.................7/7(100%)
--------------------------------------------------------------------------------

You’ll notice two exceptions here. The first appears once, and the second is repeated for every test in the lines that I removed.

  • 09-18-2018 05:34:36 PM - [ERROR] - java.lang.ExceptionInInitializerError
  • 09-18-2018 05:34:36 PM - [ERROR] - java.lang.NoClassDefFoundError: Could not initialize class com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword

If you look at the test reports, you see these same exceptions.

Again, my suspicion is that katalon needs to be informed how to run chrome. I run chrome from “/usr/bin/google-chrome”. Is this what katalon expects? I should also say that I am running on a headless system. I’ve seen some posts recommending that I set a DISPLAY variable, and I’ve tried setting this variable to “:0.0” and “localhost:10.0” and similar values, but this doesn’t seem to make any difference.

Does anyone have any idea how to fix this?

Screen Shot 2018-09-18 at 6.44.56 PM.png

Have a look at this post:

In your test case, you stop calling WebUI.openBrowser(). And you do the following:

System.setProperty("webdriver.chrome.driver", "/usr/bin/google-chrome")WebDriver driver = new ChromeDriver();// the magic lineDriverFactory.changeWebDriver(driver)WebUI.navigateToUrl('www.katalon.com')

Also you should change your commandline

cd /home/userx/katalonkatalon --args -noSplash -runMode=console -retry=0 -executionProfile="default" -browserType="Chrome (headless)" -projectPath="/home/userx/myproject/Tests/Tests.prj" -testSuitePath="Test Suites/List"
  • you should not specify the “-consoleLog” option
  • you need to change directory to the dir where the katalon binary is located

Thanks. Is there any way to do this while still calling “WebUI.openBrowser()”? I’m trying to check a few hundred tests written by students, and I can’t ask them to re-write their tests at this point.

I am not sure, but why not you try this?

System.setProperty("webdriver.chrome.driver", "/usr/bin/google-chrome")
WebUI.openBrowser('')
WebUI.navigateToUrl('www.katalon.com')

I’ve tried this out, and I’m able to run Chrome now.

I’m still not able to run tests, however. It probably has something to do with the fact that I’m trying to run on a system with no display. I have set the DISPLAY variable, but it doesn’t seem to have helped. Here’s a log excerpt.

09-19-2018 02:54:39 PM - [START]  - Start setup action : setupTestCase
09-19-2018 02:54:39 PM - [START]  - Start action : Statement - java.lang.System.setProperty("webdriver.chrome.driver", "/usr/bin/google-chrome")
09-19-2018 02:54:39 PM - [END]    - End action : Statement - java.lang.System.setProperty("webdriver.chrome.driver", "/usr/bin/google-chrome")
09-19-2018 02:54:39 PM - [START]  - Start action : Statement - driver = new org.openqa.selenium.chrome.ChromeDriver()
(process:14167): Gtk-WARNING **: 14:54:40.595: Locale not supported by C library.
Using the fallback 'C' locale.
connect /tmp/.X11-unix/X0: No such file or directory
(google-chrome:14167): Gtk-WARNING **: 14:54:40.597: cannot open display: localhost:10.0
Sep 19, 2018 2:55:00 PM org.openqa.selenium.os.OsProcess checkForError
SEVERE: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
09-19-2018 02:55:00 PM - [END]    - End action : Statement - driver = new org.openqa.selenium.chrome.ChromeDriver()
09-19-2018 02:55:00 PM - [ERROR]  - Timed out waiting for driver server to start.
Build info: version: '3.7.1', revision: '8a0099a', time: '2017-11-06T21:07:36.161Z'
System info: host: 'richard', ip: '10.0.106.93', os.name: 'Linux', os.arch: 'amd64', os.version: '4.17.0-3-amd64', java.version: '1.8.0_171'
Driver info: driver.version: ChromeDriver

Any other ideas? Thanks again.

Possibly you need Xvfb.
https://en.wikipedia.org/wiki/Xvfb

See also:

Richard,

I suppose you are still hesitating to ask your students to change their code; insert a line:

System.setProperty("webdriver.chrome.driver", "/usr/bin/google-chrome")

There is an alternative method to set System Property. See the following post:

Edit %KATALON\_STUDIO\_INSTALLED_FOLDER%\\katalon.ini file on your Linux box.

I gave up on Chrome and started using Firefox instead. I still had the display problem, but using Xvfb fixed that. Now I’m up and running. Thanks a ton for your help!

Just for the record - there is now an official Docker image for Katalon Studio. If anyone has similar issues you can take a look.