Skip to content

Latest commit

 

History

History
56 lines (36 loc) · 1.63 KB

File metadata and controls

56 lines (36 loc) · 1.63 KB

Document with an annotated screenshot

While Selenium has built-in support for capturing whole page screenshots, usually screenshots must be cropped and some times also annotated to make them useful in a documentation.

A Robot Framework library called Selenium2Screenshots provides a collection of re-usable keywords for cropping and annotating screenshots.

A cropped and annotated screenshot could look like this:

*** Settings ***

Library  Selenium2Library
Library  Selenium2Screenshots

Suite Teardown  Close all browsers

*** Variables ***

${BROWSER}  Firefox

*** Keywords ***

Highlight heading
    [Arguments]  ${locator}
    Update element style  ${locator}  margin-top  0.75em
    Highlight  ${locator}

*** Test Cases ***

Take an annotated screenshot of RobotFramework.org
    Open browser  http://robotframework.org/  browser=${BROWSER}

    Highlight heading   css=#header h1

    ${note1} =  Add pointy note
    ...    css=#header
    ...    This screenshot was generated using Robot Framework and Selenium.
    ...    width=250  position=bottom
    Capture and crop page screenshot  robotframework.png
    ...    css=#header  ${note1}

Note

The image cropping feature for robotframework-selenium2screenshots requires PIL or Pillow.