Skip to main content

Robot Framework test library for taking screenshots

Project description

Introduction

ScreenCapLibrary is a Robot Framework test library for taking screenshots. The project is hosted on GitHub and downloads can be found from PyPI.

ScreenCapLibrary is operating system independent and supports Python 2.7 as well as Python 3.4 or newer.

The library is based on RobotFramework’s standard Screenshot library. It has almost the same functionality, except that the screenshots are captured in PNG by default.

ScreenCapLibrary has the following extra features:
  • Taking screenshots in PNG, JPG/JPEG, GIF and WebP formats

  • Video capture in WebM format, embeddable in log files

  • Adjusting the compression/quality of the screenshots

  • Support for GIFs

  • Taking multiple screenshots in a given amount of time

  • Support for partial screen captures

  • Configurable monitor screen grabbing for screenshots and recording

Documentation

See keyword documentation for available keywords and more information about the library in general.

For general information about using test libraries with Robot Framework, see Robot Framework User Guide.

Installation

The recommended installation method is using pip:

pip install --upgrade robotframework-screencaplibrary

Running this command installs also the latest Robot Framework, mss, pillow, opencv-python and imageio versions. The minimum supported mss version is 3.2.1 and the minimum supported pillow version is 5.2.0. For video capture at least version 4.0.0.21 of opencv-python is required. The --upgrade option can be omitted when installing the library for the first time.

With recent versions of pip it is possible to install directly from the GitHub repository. To install latest source from the master branch, use this command:

pip install git+https://github.com/mihaiparvu/ScreenCapLibrary.git

Alternatively you can download the source distribution from PyPI, extract it, and install it:

python setup.py install

Usage

To use ScreenCapLibrary in Robot Framework tests, the library needs to first be imported using the Library setting as any other library.

When using Robot Framework, it is generally recommended to write as easy-to-understand tests as possible.

*** Settings ***
Documentation          This example demonstrates capturing a screenshot on the local
...                    machine.

Library                ScreenCapLibrary
Library                OperatingSystem
Test Teardown          Remove File  screenshot_1.jpg

*** Test Cases ***
Take A Low File Size Jpg Screenshot
    Take Screenshot    name=screenshot  format=jpg  quality=0
    File Should Exist  screenshot_1.jpg

Using with VNC

At the time of this release mss, does not work on GNU/Linux with VNC virtual desktop. As a workaround you can change the screenshot_module value at library import to PyGTK.

*** Settings ***
Library                ScreenCapLibrary  screenshot_module=PyGTK

For this to work you need to have the following dependencies installed.

  • With Python 2:

    sudo apt install python-gtk2
  • With Python 3:

    sudo apt install python-gi python-gi-cairo python3-gi python3-gi-cairo gir1.2-gtk-3.0

Support

If the provided documentation is not enough, there are various support forums available:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

robotframework-screencaplibrary-1.6.0.tar.gz (15.7 kB view details)

Uploaded Source

File details

Details for the file robotframework-screencaplibrary-1.6.0.tar.gz.

File metadata

  • Download URL: robotframework-screencaplibrary-1.6.0.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/47.3.1 requests-toolbelt/0.8.0 tqdm/4.19.8 CPython/3.6.4

File hashes

Hashes for robotframework-screencaplibrary-1.6.0.tar.gz
Algorithm Hash digest
SHA256 0bd6fcb56452125121d9a0cb1a110ea069a87de1937882193320ba4af4c6a132
MD5 4639c347e56db4b2812280f03f02b0be
BLAKE2b-256 58a3de838ca823e652e16dc18343fe0e4f5f5e6d61b08f3f7d3fc1b79fc4f690

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page