How to stop capturing screenshot for Warning steps

I have many steps in my test with step failure handling as “FailureHandling.OPTIONAL” and it throws warning when failed. But, it still captures a screenshot. Is there a way to stop capturing screenshot for Warnings ?
Capture only when step fails.

Team, is it possible to stop capturing screenshots for warning steps?

Hello Katalon Development Team,

I was looking for disabling screen capture for warning steps and still there is no answer. And now, in the latest releases, the test report includes failure log for the warning steps. Please share if there is any option to disable the logs and screenshot for WARNING steps.


@devalex88 @kazurayam Could you address this issue…!

Was this working in a earlier version? i cant remember it ever being a thing. If im honest i dont see the problem with it. If you use the html report it still marks the step as a pass, you only notice it if you open up that step. Is there a reason you want this feature? maybe we can think of a workaround for now.

I believe the behavior is same in the earlier versions as well. But, my question is, tool has option to “Take screenshot when execution failed”. But, it still takes screenshots for warning steps.

The problem is: My tests runs in Jenkins-Docker. An email will be triggered on failure of the test by attaching html file. The email servers doesn’t allow to attach if the file size is more than 25MB and user will not receive any email. As a work around, we are compressing the html file before email trigger.
But, day by day we are adding more tests to the suite and the html size keeps on increasing. My test report file size is >125MB.

Test report size can be reduced if we have an option to disable capturing screenshot for Warning steps.

1 Like

Ahh okay i understand. I do agree that it can be unecessary data taken up by screenshots you dont need to see. Im sure one of the devs will see this and mark it as an improvement for the product. Thanks for your recommendation :slight_smile:

1 Like

Unnecessary logs in the test report.

Hi @duyluong … Could you review and consider this request for next releases !


We will consider about this case. Thanks for your suggestion.



Even I am looking for this support. We run test suites on local machine sometime and report folder size is higher and higher due to unwanted screenshots. It will be really helpful if it is addressed. I have asked similar thing and no response is received yet.

verifyElementPresent takes screenshot on step Pass - Katalon Studio / Web Testing - Katalon Community

I was not aware of this issue up until now.

I looked into the source of Katalon Studio, and found a way to implement your idea.

com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain has a method StepFailed.

The current source looks like this:

    public static stepFailed(String message, FailureHandling flHandling, Throwable t, boolean takeScreenShot)
    throws StepFailedException {
        KeywordMain.stepFailed(message, flHandling, new StepFailedException(message, t), 
            new WebUIScreenCaptor().takeScreenshotAndGetAttributes(takeScreenShot));

I found that, when WebUI.verifyElementPresent() keyword has got a failure (for example, a HTML element searched for was not found in the page), it will call WebUIKeywordMain.stepFailed() with the argument takeScreenshot with value of true. Therefore a screenshot will be taken regardless which type of FailureHandling is selected.

If Katalon Team changes the code as follows, @Lakshminarayana_D and other people would be happy.

    public static stepFailed(String message, FailureHandling flHandling, Throwable t, boolean takeScreenShot) throws StepFailedException {
            boolean requireScreenShot = takeScreenShot
            if (flHandling == FailureHandling.OPTIONAL) {
                    requireScreenShot = false
            KeywordMain.stepFailed(message, flHandling, new StepFailedException(message, t),
                   new WebUIScreenCaptor().takeScreenshotAndGetAttributes(requireScreenShot));

This code will not take screenshot when FailureHandling.OPTIONAL is assigned.

I tried to find out a way to change the method implementation dynamically using Groovy’s MetaProgramming technique. I thought it should be possible in theory. But unfortunately, I could not achieve it. I am still struggling. Anyway, I could not provide an easy-to-use solution for this issue. We need to wait for Katalon Team to address this, and tackle it.




update at 19 JUNE 2021

I have found out a thing. I would conclude that it is impossible to modify, by Groovy MetaProgramming technique, WebUI.verifyElementPresent() keyword with FailureHandling.OPTIONAL NOT to take screenshot.

The reason is that the WebUI.verifyElementPresent() keyword’s source is annotated with groovy.transform.CompileStatic as the following:

    public boolean verifyElementPresent(TestObject to, int timeOut, FailureHandling flowControl) throws StepFailedException {

According to the documetation of CompileStatic:

This will let the Groovy compiler use compile time checks in the style of Java then perform static compilation, thus bypassing the Groovy meta object protocol.

I made a custom keyword that dynamically modifies the implementation of com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain using Groovy MetaProgramming technique. Yes, I could do it.

But the WebUI.verifyElementPresent() calls the original(unmodified) WebUIKeywordMain. I could find no way to force WebUI.verifyElementPresent() to call the modified WebUIKeywordMain. It’s because WebUI.verifyElementPresent() is compiled with the @CompileStatic annotation. I will give up.

… I have found out the reason why my codes doesn’t work; now I feel I have understood how Groovy MetaProgramming works in depth.

The following 2 keywords function almost identical.

  • WebUI.verifyElementPresent(testobject, 5, FailureHandling.OPTIONAL) source
  • WebUI.waitForElementPresent(testobject, 5, FailureHandling.OPTIONAL) source

If you read the source codes of the two, you will find them just the same when the given testobject is present in the web page; but there is a difference when the testobject is not found in the web page within the timeout period,

  • WebUI.verifyElementPresent() emits a screenshot image and prints a long StackTrace in the Console.
  • WebUI.waitForElementPresent() does not emits any screenshot, does not print a StackTrace but prints a single line of warning message.

This difference must be significant for you @prajakta.

My proposal.

In the case where you can specify FailureHandling.OPTIONAL, I suppose that you are not very serious about the keyword’s result, are you? In that case, you could use WebUI.waitForElementPresent() rather than WebUI.verifyElementPresent(); thus you will have less amount of screenshots.

It depends on each individual keyword’s implementation if it emits screenshot or not. You should read the source of keywords to find out how each keyword works. If a keyword is calling WebUIKeywordMain.stepFailed(xxx,xxx,xxx,xxx) method, then it would emit screenshots on failure. In general, WebUI.verifyXXX keywords emits screenshot, WebUI.waitForXXXX keywords don’t.

1 Like

If you do not want a long StackTrace printed in the Console and the Report, you should not use WebUI.verifyXXXX keywords. You should rather use WebUI.waitForXXXX keywords. WebUI.waitForXXXX won’t print any StackTrace.

Are you aware that you can toggle off taking screenshots on by Project > Settings > Execution