NullPointerException AFTER test case execution in headless mode

I have a test that fails with java.lang.NullPointerException, but only when run in console (headless) mode (it runs fine when executed in _headful(?) _browser).

06-14-2018 01:38:35 PM - [INFO]   - Found 1 web elements with id: 'Object Repository/DUMMY' located by 'By.cssSelector: div.noty_type_warning' in '20' second(s)
java.io.FileNotFoundException: C:\Program Files\Katalon\Katalon_Studio_Windows_64-5.4\ErrorScreenshots\ElementScreenshot_201806141338274.png (The system cannot find the path specified)
        at java.io.RandomAccessFile.open0(Native Method)06-14-2018 01:38:35 PM - [END]    - End action : com.at.util.ScreenshotHelper.catchNotyMessage
        at java.io.RandomAccessFile.open(RandomAccessFile.java:316)06-14-2018 01:38:35 PM - [END]    - End action : Statement - For ([i = 1, i < 10, (i++)])
        at java.io.RandomAccessFile.<init>(RandomAccessFile.java:243)06-14-2018 01:38:35 PM - [END]    - End Test Case : Test Cases/TC-8000/TC-0088 sa cathcerom
06-14-2018 01:38:35 PM - [END]    - End Test Suite : Test Suites/TS-xxxxx paralele/TS-xxxxx00   at javax.imageio.stream.FileImageOutputStream.<init>(FileImageOutputStream.java:69)
        at com.sun.imageio.spi.FileImageOutputStreamSpi.createOutputStreamInstance(FileImageOutputStreamSpi.java:55)
        at javax.imageio.ImageIO.createImageOutputStream(ImageIO.java:419)
        at javax.imageio.ImageIO.write(ImageIO.java:1530)
        at javax.imageio.ImageIO$write.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 com.at.util.ScreenshotHelper.takeWebElementScreenshot(ScreenshotHelper.groovy:31)
        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.reflection.CachedMethod.invoke(CachedMethod.java:93)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1215)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
        at groovy.lang.DelegatingMetaClass.invokeMethod(DelegatingMetaClass.java:151)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:69)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
        at com.at.util.ScreenshotHelper.catchNotyMessage(ScreenshotHelper.groovy:45)
        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.reflection.CachedMethod.invoke(CachedMethod.java:93)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1215)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:812)
        at groovy.lang.DelegatingMetaClass.invokeMethod(DelegatingMetaClass.java:144)
        at com.at.util.ScreenshotHelper.invokeMethod(ScreenshotHelper.groovy)
        at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:46)
        at org.codehaus.groovy.runtime.callsite.StaticMetaClassSite.call(StaticMetaClassSite.java:53)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
        at Script1528724223478.run(Script1528724223478.groovy:73)
        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:295)
        at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:286)
        at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:265)
        at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:257)
        at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:201)
        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:106)
        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 TempTestSuite1528976222802.run(TempTestSuite1528976222802.groovy:35)
        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)
06-14-2018 01:38:35 PM - [ERROR]  -
06-14-2018 01:38:35 PM - [ERROR]  - Test Cases/TC-8000/TC-0088 sa cathcerom FAILED because (of) java.lang.NullPointerException

The funny thing is, as you can see, the error is thrown after the script execution has ended.

The TC is supposed to take a screenshot of some error or warning messages that appear on screen. When both error and warning (this is my app’s warning) message appear, the screenshot is taken and only warning (KS warning) is thrown.

**Edit: **posted to Katalon Recorder by mistake.

Bump

Can I have a look at this object’s properties?

This is the “DUMMY” object in the object repository:

But, it is modified at runtime:

TestObject noty_warning = WebUI.modifyObjectProperty(findTestObject("DUMMY"), 'css', 'equals', 'div.noty_type_warning', true)

When test is run in normal mode, the object is found as expected. But in headless mode, I get the above error.

2018-06-20_13-23-39.png

So is there any step from your side which capturing a screenshot due to this "error: java.io.FileNotFoundException: C:\Program Files\Katalon\Katalon_Studio_Windows_64-5.4\ErrorScreenshots\ElementScreenshot_201806141338274.png (The system cannot find the path specified)
"?

Yes, the script is taking a screenshot with a timestamp (according to this ElementScreenshot_201806141338274.png filename, the script finished execution and created this file but it is unable to find it - I checked: it is not in the filesystem.)

Any progress?