[WebUI] Take Element Screenshot
Description
Take a screenshot of a specific web element. The captured image will be saved in .png format.
Keyword name: takeElementScreenshot
Note:
From version 7.7.0, this keyword is available.
Parameters
Parameter | Parameter Type | Required | Description |
---|---|---|---|
fileName | String | Optional | Represents a path to the saved image. The path can be absolute path or relative path. |
to | TestObject | Optional | Represents the element you want to take screenshot of. |
flowControl | FailureHandling | Optional | Specify failure handling schema to determine whether the execution should be allowed to continue or stop. |
Example
You want to take a screenshot of an element that you have captured by using Katalon Spy Utility and stored in Test Object > UI > logo. The file name is You want to take a screenshot of a Test Object stored in a variable named
logo.png
and stored in the report folder. Default failure handling is used:import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.configuration.RunConfiguration as RunConfiguration
WebUI.takeElementScreenshot(RunConfiguration.getReportFolder() + '/logo.png', findTestObject('UI/logo'))
header
for TestOps Vision. Use the default file name:import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
// where ignoredElements is a user-defined List-typed variable.
WebUI.takeElementScreenshot(header)