Skip to content

Requirement: Return embed screenshot path while using Capture Page Screenshot #1934

Description

@adiralashiva8

Request Type: Requirement

Keyword: Capture Page Screenshot EMBED

Details:

  • We would like to show error screenshot in TEST MESSAGE section. This helps in quick analysis

Approach:

Adjusting code like below in screenshot.py helps to return base64 path

def _capture_page_screen_to_log(self):
        screenshot_as_base64 = self.driver.get_screenshot_as_base64()
        self._embed_to_log_as_base64(screenshot_as_base64, 800)
        return screenshot_as_base64    # old: return EMBED

Usage In Robot:

We display base64 image in TEST MESSAGE section

*** Settings ***
Library     SeleniumLibrary    run_on_failure=Capture Embed Screenshot

*** Keywords ***
Capture Embed Screenshot
    ${path}=    Capture Page Screenshot    EMBED
    Set Test Message    *HTML* <img src="data:image/png;base64,${path}" width="800px">    append=${True}
    

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions