Screenshot - Documentation

Introduction

This library supports taking full-screen screenshots of the desktop.

The library can be initialized with two arguments: 'default_directory' and
'log_file_directory'. If the 'default_directory' is provided, all the
screenshots will be saved under that directory by default. If the
'default_directory' is not provided, the system temporary directory is used
as default.
'log_file_directory' is used to create relative paths when screenshots are
logged. By default, absolute paths are used.

The library depends on standard Java APIs and thus requires a Jython runtime
environment. The library does not, however, require any specific operating
system. While the library has been tested on Windows and Linux, any
operating system for which the JDK is available, should be sufficient.

Shortcuts

Keywords

Keyword Arguments Documentation
Log Screenshot basename=screenshot, directory=None, log_file_directory=None, width=100% Takes a screenshot and logs it to Robot Framework's log.

Saves the files as defined in the keyword 'Save Screenshot' and creates
a picture to Robot Framework's log. 'directory' defines the directory
where the screenshots are saved. By default, its value is
'default_directory', which is set at the library import or with the
keyword 'Set Screenshot Directories'. 'log_file_directory' is used to
create relative paths to the pictures. This allows moving the log and
pictures to different machines and having still working pictures. If
'log_file_directory' is not given or set (in the same way as
'default_directory' is set), the paths are absolute.
Save Screenshot basename=screenshot, directory=None Saves a screenshot with a generated unique name.

The unique name is derived based on the provided basename and directory
passed in as optional arguments. If a directory is provided, the
screenshot is saved under that directory. Otherwise, the
'default_directory' set during the library import or by the keyword 'Set
Screenshot Directories' is used. If a basename for the screenshot file
is provided, a unique filename is determined by appending an underscore
and a running counter. Otherwise, the basename defaults to 'screenshot'.

Examples:

Save Screenshot mypic /home/user
=> /home/user/mypic_1.jpg, /home/user/mypic_2.jpg, ...

Save Screenshot mypic
=> /tmp/mypic_1.jpg, /tmp/mypic_2.jpg, ...

Save Screenshot
=> /tmp/screenshot_1.jpg, /tmp/screenshot_2.jpg, ...
Save Screenshot To path Saves a screenshot to the specified file.

The directory holding the file must exist or an exception is raised.
Set Screenshot Directories default_directory=None, log_file_directory=None Used to set 'default_directory' and 'log_file_directory'.

See the library documentation for details.