How to take screenshot and save it with a current date and time in Karate UI Automation Framework

Viewed 308

How to take screenshot and save it with a current date and time in Karate UI Automation.

1 Answers

The screenshot() API actually returns a Java byte-array.

What you do with that byte-array is up to you. The karate.write() usage is just an example, please use some custom code if needed.

* def bytes = screenshot(false)
* def file = karate.write(bytes, 'test.png')
* print 'screenshot saved to:', file
Related