you can get your robot screenshot into the built-in report. WebUI.takeScreenshot and Windows.takeScreenshot do not use any special api, they just write the png into the report folder and log a passed step with an “attachment” attribute pointing at the file. the html report picks that up and shows the thumbnail like a normal screenshot step. you can do the same from a custom keyword:
import java.awt.Rectangle
import java.awt.Robot
import java.awt.Toolkit
import javax.imageio.ImageIO
import com.kms.katalon.core.annotation.Keyword
import com.kms.katalon.core.constants.StringConstants
import com.kms.katalon.core.logging.KeywordLogger
class ReportShot {
private static final KeywordLogger logger = KeywordLogger.getInstance(ReportShot)
@Keyword
static String capture(String name = 'sap') {
File f = new File(logger.getLogFolderPath(), name + '_' + System.currentTimeMillis() + '.png')
Rectangle screen = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize())
ImageIO.write(new Robot().createScreenCapture(screen), 'png', f)
logger.logPassed('screenshot ' + f.name, [(StringConstants.XML_LOG_ATTACHMENT_PROPERTY): f.name])
return f.absolutePath
}
}
then in the test case, right after your jacob transaction step:
CustomKeywords.'yourpackage.ReportShot.capture'('va01')
the file lands in the same Reports/… folder as the execution log, so it also travels with the report when you upload to true platform. someone used the same attribute with an absolute path for pdf reports here and it worked too: How to add images to the PDF report without using Katalon features - #3 by jhilario
two notes. it is internal api (KeywordLogger, StringConstants), so pin it in a custom keyword and retest after a studio upgrade. and java robot needs an unlocked interactive desktop, a locked screen or disconnected rdp gives you the black image you saw.