Skip to content

Capture Fullpage Screenshot #1459

@F3licity

Description

@F3licity

This is not a bug, but rather a new feature.
Often the browser page is longer that is shown and the user needs to scroll down to see the rest of the page.

Robot Framework often takes a screenshot on failure, but the screenshot captured only shows half of the page and might not include the problematic area.
It would be nice to have a keyword that captures a whole length image.

This is my python script to implement such functionality

def capture_fullpage_screenshot(url):
    """ Creating a Full-Page screenshot.

    Use this keyword for debugging purposes.
    Creates an image called full_page_screenshot.png.
    """
    options = webdriver.ChromeOptions()
    options.add_argument("start-maximized")
    options.add_argument("enable-automation")
    options.add_argument("--headless")
    options.add_argument("--no-sandbox")
    options.add_argument("disable-infobars")
    options.add_argument("--disable-extensions")
    options.add_argument("--disable-gpu")
    driver = webdriver.Chrome(options=options)
    current_window = driver.get_window_size()

    driver.get(url)

    time.sleep(12)

    height = driver.execute_script("return document.body.scrollHeight")
    driver.set_window_size(1920, height)
    driver.save_screenshot("full_page_screenshot.png")

    driver.set_window_size(current_window["width"], current_window["height"])

However, it is not yet properly working, as it does not work inside docker.
And it has a hardcoded file name.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy