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
- Where screenshots are saved
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.
- wxPython :: http://wxpython.org :: Generic Python GUI toolkit.
- PyGTK :: http://pygtk.org :: This module is available by default on most Linux distributions.
- Pillow :: http://python-pillow.github.io :: Only works on Windows. Also the original PIL package is supported.
- Scrot :: http://en.wikipedia.org/wiki/Scrot :: Not used on Windows. Install with
apt-get install scrotor similar.
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 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.