Skip to main content

[Windows] Take Screenshot

Description

Captures a screenshot of the currently focused Windows application screen.

Keyword name: Windows.takeScreenshot

Parameters

ParameterParameter TypeMandatoryDescription
fileNameStringOptionalRepresents a path to the saved image. The path can be absolute path or relative path.
flowControlFailureHandlingOptionalSpecify failure handling schema to determine whether the execution should be allowed to continue or stop.
screenshotOptionsMapOptionalRepresents the information to be printed on the captured screenshot.

The screenshotOptions parameter has the following properties:

ParameterParameter TypeMandatoryDescription
TextStringYesDetermines the information to be printed on the captured screenshot. This string should be limited to 100 characters and must not be null or empty.
xIntegerOptionalNumber of pixels from the left side of the image. The default is 0.
yIntegerOptionalNumber of pixels from the top of the image. The default is 0.
fontStringOptionalFont name. The default is Arial.
fontSizeIntegerOptionalSize of font. The default is 12, maximum is 50.
fontColorStringOptionalHex string of color. Default is "#000000" (black).
fontStyleFontStyleOptionalCan be Plain, Italic or Bold. Default is Plain.

Example

You want to take a screenshot of a Windows application in a device:

"Start the note pad application"
Windows.startApplication('C:\\Windows\\System32\\notepad.exe')

'Take screenshot of current device screen'
Windows.takeScreenshot("D:\screenshot.png")

"Close note pad application"
Windows.closeApplication()
Was this page helpful?