Can't open Chrome through ssh or with Jenkins

Hello,

I’m running Katalon Studio 5.3 on a Mac Mini running MacOS Sierra (10.12.6). Whenever I pull up a terminal on the machine and run a test using a console command, it opens Chrome and everything runs just fine. However, when I try running the exact same command through a Jenkins (running on the same machine) build shell or after ssh-ing in through a terminal on another machine, it fails to open Chrome. The same thing happens if I try another browser.

I’ve verified that the chromedriver is up to date, and I’ve even tried matching the environment variables after ssh-ing, but that didn’t change anything. Any clue as to how I could fix this issue?

Here’s an example of the command I’ve been running:

/Applications/Katalon\ Studio.app/Contents/MacOS/katalon --args -runMode=console -consoleLog -projectPath="/My/Project/Path" -reportFolder="/My/Report/Folder" reportFileName="report" -retry=0 -testSuitePath="My/Test/Suite" -browserType="Chrome"

Problem is still persistent, It appears that the issue is related to browser drivers loading. The Jenkins job just skips right over this step and goes from:

03-14-2018 01:50:04 PM - [START] - Start action: openBrowser
03-14-2018 01:50:04 PM - [START] - End action: openBrowser

Has anyone else encountered this issue and knows how to resolve?

Hi there,

Is there any error message at all?

Regards

This is the error that it spits out:

FAILED because (of) java.awt.HeadlessException

I’m thinking that’s just because Chrome isn’t running and therefore it can’t find what it’s looking for.

We are testing the Jenkins/Katalon functionality on a Windows machine today. The issue is still persistent on Linux machines.

Clutch QA said:

This is the error that it spits out:

FAILED because (of) java.awt.HeadlessException

I’m thinking that’s just because Chrome isn’t running and therefore it can’t find what it’s looking for.

IS there no root cause message after this error?

No, that’s all we get unfortunately.

We can expand this issue to all browsers, including headless options. Has no one experienced this issue besides us?

1 Like

Clutch QA said:

We can expand this issue to all browsers, including headless options. Has no one experienced this issue besides us?

I’m not sure if you were able to overcome your issue, however I was able to remedy this by installing Xvfb on the Jenkins server (Ubuntu 18.04) & then install & configure the Jenkins Xvfb Plugin to use that installed executable.

You may also need to add your jenkins user to the xhost by running “xhost +si:localuser:jenkins”.

I have a similar problem if not the same but in a windows server. When using the katalon command in Jenkins I have this error.

Test Cases/Login_Page/Login Transware Success FAILED because (of) (Stack trace: com.kms.katalon.core.exception.StepFailedException: Unable to open browser with url: ‘’ (Root cause: org.openqa.selenium.WebDriverException: unknown error: unable to discover open pages
(Driver info: chromedriver=2.42.591088 (7b2b2dca23cca0862f674758c9a3933e685c27d5),platform=Windows NT 6.3.9600 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 61.07 seconds
Build info: version: ‘3.7.1’, revision: ‘8a0099a’, time: ‘2017-11-06T21:07:36.161Z’
System info: host: ‘SERVERNAME’, ip: ‘SERVERIP’, os.name: ‘Windows Server 2012 R2’, os.arch: ‘amd64’, os.version: ‘6.3’, java.version: ‘1.8.0_181’
Driver info: driver.version: CChromeDriver)
at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:36)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:65)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:27)
at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword.openBrowser(OpenBrowserKeyword.groovy:81)
at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword.execute(OpenBrowserKeyword.groovy:67)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:53)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.openBrowser(WebUiBuiltInKeywords.groovy:60)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$openBrowser.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at Script1536058444070.run(Script1536058444070.groovy:22)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:183)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:108)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:294)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:285)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:264)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:256)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:200)
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestCaseMainPhase(TestSuiteExecutor.java:129)
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(TestSuiteExecutor.java:112)
at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:81)
at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:142)
at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:141)
at TempTestSuite1539763921094.run(TempTestSuite1539763921094.groovy:36)
at groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:263)
at groovy.lang.GroovyShell.run(GroovyShell.java:518)
at groovy.lang.GroovyShell.run(GroovyShell.java:507)
at groovy.ui.GroovyMain.processOnce(GroovyMain.java:653)
at groovy.ui.GroovyMain.run(GroovyMain.java:384)
at groovy.ui.GroovyMain.process(GroovyMain.java:370)
at groovy.ui.GroovyMain.processArgs(GroovyMain.java:129)
at groovy.ui.GroovyMain.main(GroovyMain.java:109)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:109)
at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:131)
)

Don’t know if it’s help to help me, but I use a TestListener that open the browser but I tryed without it and Jenkins run my Test Suite Collection with fails as well. All test with UI fail. Did I need to import some this more to run with Jenkins ?

import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint

import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase

import static com.kms.katalon.core.testdata.TestDataFactory.findTestData

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject

import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint

import com.kms.katalon.core.model.FailureHandling as FailureHandling

import com.kms.katalon.core.testcase.TestCase as TestCase

import com.kms.katalon.core.testdata.TestData as TestData

import com.kms.katalon.core.testobject.TestObject as TestObject

import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS

import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile

import internal.GlobalVariable as GlobalVariable

import com.kms.katalon.core.annotation.BeforeTestCase

import com.kms.katalon.core.annotation.BeforeTestSuite

import com.kms.katalon.core.annotation.AfterTestCase

import com.kms.katalon.core.annotation.AfterTestSuite

import com.kms.katalon.core.context.TestCaseContext

import com.kms.katalon.core.context.TestSuiteContext

class NewTestListener {

/**

* Executes before every test case starts.

* @param testCaseContext related information of the executed test case.

*/

@BeforeTestCase

def sampleBeforeTestCase(TestCaseContext testCaseContext) {

println testCaseContext.getTestCaseId()

println testCaseContext.getTestCaseVariables()

WebUI.openBrowser(’’)

WebUI.navigateToUrl(GlobalVariable.G_Site_URL + ‘/User/Login?ReturnUrl=%2f’)

}

/**

* Executes after every test case ends.

* @param testCaseContext related information of the executed test case.

*/

@AfterTestCase

def sampleAfterTestCase(TestCaseContext testCaseContext) {

println testCaseContext.getTestCaseId()

println testCaseContext.getTestCaseStatus()

WebUI.closeBrowser()

}

/**

* Executes before every test suite starts.

* @param testSuiteContext: related information of the executed test suite.

*/

@BeforeTestSuite

def sampleBeforeTestSuite(TestSuiteContext testSuiteContext) {

println testSuiteContext.getTestSuiteId()

}

/**

* Executes after every test suite ends.

* @param testSuiteContext: related information of the executed test suite.

*/

@AfterTestSuite

def sampleAfterTestSuite(TestSuiteContext testSuiteContext) {

println testSuiteContext.getTestSuiteId()

}

}

I have the same problem through Windows machine: if I start the test in katalon studio and katalon command line from cmd, the test work and test suite too. When I start the test in jenkins, it doesn’t work. This my command in jenkins:

cd C:\Users\ALBERTO\Desktop\Katalon_Studio_Windows_64-5.8.0 && katalon -noSplash -runMode=console -projectPath=“C:\Users\ALBERTO\Katalon Studio\Web Sport\Web Sport.prj” -reportFolder="%WORKSPACE%" -retry=0 -testSuitePath=“Test Suites/Sport Web” -executionProfile=“default” -browserType=“Chrome”

I think that chrome driver from jenkins don’t work and the chrome browser doesn’t open automated shell.

Please Help me

I hava the same problem in Mac 10.14, Katalon 5.10.1.
I use jenkins to run my testcase, and this is the exception.

java.awt.HeadlessException at org.sikuli.api.robot.desktop.AWTDesktop.<clinit>(AWTDesktop.java:27) at org.sikuli.api.robot.desktop.DesktopScreen.getSize(DesktopScreen.java:43) at org.sikuli.api.AbstractScreenRegion.<init>(AbstractScreenRegion.java:19) at org.sikuli.api.DefaultScreenRegion.<init>(DefaultScreenRegion.java:37) at org.sikuli.api.DesktopScreenRegion.<init>(DesktopScreenRegion.java:11) at com.kms.katalon.core.webui.common.ScreenUtil.<init>(ScreenUtil.java:26) at com.kms.katalon.core.webui.keyword.internal.WebUIAbstractKeyword.<clinit>(WebUIAbstractKeyword.groovy:20) at com.kms.katalon.core.keyword.internal.KeywordExecutor.getActions(KeywordExecutor.groovy:130) at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:49) at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.openBrowser(WebUiBuiltInKeywords.groovy:60) at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$openBrowser.call(Unknown Source)