How to SAP GUI screenshot,so that it is attached in inbuilt katalon reports
WebUI.takeScreenshot() will work
If this keyword doesn’t work then there are other options like robot capture and more, but I guess takescreenshot will surely work.
Please let us know
It throws error once we close browser. Also if I don’t close the browser and use it with SAP GUI open ,it return black screenshot in the report.
Robot inhave created but it doesn’t comes in the katalon reports
For SAP GUI screenshot capture that appears in Katalon reports, you need to use Windows keywords (not WebUI) since SAP GUI is a desktop application.
Solution: Use Windows.takeScreenshot()
Since you’re testing SAP GUI (desktop app), use Windows keywords instead of WebUI:
// In Script mode
import static com.kms.katalon.core.checkpoint.CheckpointKeyword.*
import com.kms.katalon.core.desktop.keyword.WindowsKeyword
// Take full desktop screenshot (includes SAP GUI)
Windows.takeScreenshot()
// Or take screenshot of specific SAP element
Windows.takeElementScreenshot(findTestObject('Object Repository/SAP/Your_Element'))
Why WebUI.takeScreenshot() Doesn’t Work
-
WebUI.takeScreenshot()only works for browser-based web testing -
When you close the browser, there’s no web driver context, causing the error you’re seeing
-
SAP GUI is a Windows desktop application, not a web application
Why Robot Screenshots Don’t Appear in Reports
Robot Framework screenshots are saved as external files but not automatically attached to Katalon’s built-in test reports. You need to use Katalon’s native Windows keywords for report integration.
Recommended Approach
Option 1: Use Windows Keywords (Best for Reports)
// After your SAP GUI test steps
Windows.takeScreenshot() // Full desktop screenshot
// OR
Windows.takeElementScreenshot(findTestObject('Object Repository/SAP/Specific_Element'))
This will automatically attach screenshots to your Katalon test reports.
Option 2: Use AShot Plugin (Alternative)
If you need more control:
-
Install the katalon-studio-ashot-plugingithub+1
-
Use custom keywords:
CustomKeywords.'kms.turing.katalon.plugins.visualtesting.ScreenCapture.takeScreenshot'('sap_screenshot.png', FailureHandling.OPTIONAL)
Screenshots save to the Screenshots/ folder in your project.
Option 3: Manual Attachment (Workaround)
If Windows keywords still don’t work:
import org.apache.commons.io.FileUtils
import java.awt.Robot
import java.awt.Rectangle
import java.awt.Toolkit
// Capture screen
Robot robot = new Robot()
Rectangle screenRect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize())
BufferedImage screenFullImage = robot.createScreenCapture(screenRect)
// Save to file
File screenshotFile = new File('Screenshots/sap_manual.png')
FileUtils.writeByteArrayToFile(screenshotFile, ImageIO.toByteArray(screenFullImage))
// Attach to report (requires custom reporting logic)
Key point: For SAP GUI (desktop), always use Windows keywords (Windows.takeScreenshot()) — not WebUI keywords — to ensure screenshots appear in Katalon reports
According to their documentation
Introducing the SAP GUI there are 3 types of SAP GUI
- SAP GUI for Windows
- SAP GUI for Java
- SAP GUI for HTML
Which type of SAP GUI you are working on?
SAP GUI for Windows
Will check and update. Thanks for your reply
Good to know this,
Hmmm then Windows.takeScreenshot() will work, as per Dinesh’s post
It not working.
We are using Jacob to launch SAP GUI session not through Katalon Windows automation and hence Windows.screenshot cannot access it.
What is Jacob? Any URL for reference?
By Jacob- do you mean Java COM Bridge?
If I assume it yes, then Katalon’s Windows Testing engine is getting bypassed entirely, as Java COM Bridge is a completely different mechanism