[WebUI] Take Full Page Screenshot
Description
Take entire-page screenshot, including overflow parts. The captured image will be saved in .png format. This method simulates a scroll action to take a number of shots and merge them together to make a full-page screenshot.
Keyword name: takeFullPageScreenshot
Warning:
If this method is used with the ignored elements, JavaScript is required to be enabled on test browser. The method used to take a full-paged screenshot is simulating a scroll action to the end of the page. If the web page uses infinity-scrolling, it's not recommended to use this keyword.
Parameters
Parameter | Parameter type | Required | Description |
---|---|---|---|
fileName | String | Optional | Represents the path to the saved image. The path can be absolute path or relative path. |
ignoredElements | List | Optional | List of Test Objects you want to hide when taking a screenshot. |
flowControl | FailureHandling | Optional | Specify failure handling schema to determine whether the execution should be allowed to continue or stop. |
Example
- Description: Take entire-page screenshot, including overflow parts. The captured image will be saved in '.png' format. This method simulates a scroll action to take a number of shots and merge them together to make a full-page screenshot.
- Keyword name: takeFullPageScreenshot
- Keyword syntax:
WebUI.takeFullPageScreenshot(fileName, ignoredElements, flowControl)
Parameters:
Name: fileName
- Description: A String that represents the path to the saved image. The path can be absolute path or relative path.
- Parameter Type: String
- Mandatory: Optional
Name: ignoredElements
- Description: List of Test Objects you want to hide when taking a screenshot.
- Parameter Type: List
- Mandatory: Optional
Name: flowControl
- Description: Specify failure handling schema to determine whether the execution should be allowed to continue or stop.
- Parameter Type: FailureHandling
- Mandatory: Optional
Examples:
Given that no elements are going to be hidden, you want to take a full-page screenshot with a default name and use default failure handling:You want to take a full-page screenshot that will be saved in a file named You want to take a full-page screenshot that will be saved to a file
WebUI.takeFullPageScreenshot()
fullviewno_logo.png
in the report folder and hide some web elements:import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.configuration.RunConfiguration as RunConfiguration
WebUI.takeFullPageScreenshot(RunConfiguration.getReportFolder() + '/full_view_no_elements.png', [findTestObject('UI/logo')])
E:\fullviewno_elements.png
and hide some web elements defined in a variable named ignoredElements
:// where ignoredElements is a user-defined List-typed variable.
WebUI.takeFullPageScreenshot('E:\\full_view_no_elements.png', ignoredElements)