Jenkins and Katalon

I am trying to take a screenshots when something fail. My script works perfect in Katalon Studio, but when I run the same script in Jenkins, I get error below…

This function cause the error WebUI.takeScreenshot(sTCID, FailureHandling.CONTINUE_ON_FAILURE)

Env : Chrome Headless on MAC

2019-06-18 15:34:16.607 WARN c.k.k.core.keyword.internal.KeywordMain - 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.TakeScreenshotKeyword.takeScreenshot(TakeScreenshotKeywo


you will always get screenshot if build fails without adding external screenshot picking
check from Katalon Analytics, there are logs & screenshots if step will fail.
Maybe you have to start Jenkins as process not the service, not sure about that

Thank you for reply. I am not sure why code below works perfectly on Katalon Studio but from Jenkins it throws error.

WebUI.takeScreenshot(“ABC”, FailureHandling.OPTIONAL)

Install "xvfb " on Jenkins server and try again. Hope it will work.