How to stop capturing screenshot for Warning steps

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