Note: You are looking at a static snapshot of documentation related to Robot Framework automations. The most recent documentation is at https://robocorp.com/docs

Screenshot

Library for taking screenshots on the machine where tests are executed.

Taking the actual screenshot requires a suitable tool or module that may need to be installed separately. Taking screenshots also requires tests to be run with a physical or virtual display.

Table of contents

Supported screenshot taking tools and modules

How screenshots are taken depends on the operating system. On OSX screenshots are taken using the built-in screencapture utility. On other operating systems you need to have one of the following tools or Python modules installed. You can specify the tool/module to use when importing the library. If no tool or module is specified, the first one found will be used.

Where screenshots are saved

By default screenshots are saved into the same directory where the Robot Framework log file is written. If no log is created, screenshots are saved into the directory where the XML output file is written.

It is possible to specify a custom location for screenshots using screenshot_directory argument when importing the library and using Set Screenshot Directory keyword during execution. It is also possible to save screenshots using an absolute path.

ScreenCapLibrary

ScreenCapLibrary is an external Robot Framework library that can be used as an alternative, which additionally provides support for multiple formats, adjusting the quality, using GIFs and video capturing.

Importing

Configure where screenshots are saved.

If screenshot_directory is not given, screenshots are saved into same directory as the log file. The directory can also be set using Set Screenshot Directory keyword.

screenshot_module specifies the module or tool to use when using this library outside OSX. Possible values are wxPython, PyGTK, PIL and scrot, case-insensitively. If no value is given, the first module/tool found is used in that order.

Examples:

SettingValueValue
LibraryScreenshot
LibraryScreenshot${TEMPDIR}
LibraryScreenshotscreenshot_module=PyGTK