question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Capture Fullpage Screenshot

See original GitHub issue

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.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
pekkaklarckcommented, Sep 27, 2019

This functionality would be nice, but I see various problems in the proposed implementation:

  • Not sure would the newly opened browser see the exact same page than the original one. The new browser would also miss possible custom configuration that the original had.
  • 12 second sleep.
1reaction
aaltatcommented, Dec 4, 2019

Knowing when to webapp is ready is actually quite difficult problem and therefore removing the sleep may require application specific logic. I would still lean to use the Selenium API and make an implementation based on that, even when it works only with Firefox. But it’s good that you got your keyword improved and I bet you learned lot of things.

Read more comments on GitHub >

github_iconTop Results From Across the Web

GoFullPage - Full Page Screen Capture
The simplest way to take a full page screenshot of your current browser window. Click on the extension icon (or press Alt+Shift+P), ...
Read more >
How to take a full-page screenshot in Google Chrome -- 4 ways
Step 1: Find Developer Tools · Step 2: Don't panic and Click Run Command · Step 3: Select Capture full size screenshot.
Read more >
How to Take a Full-Page Screenshot - Zapier
To download your full-page screenshot, just open the extra menu options in your Device Toolbar (see screenshot), and select "Capture full size ...
Read more >
GoFullPage
The simplest and most reliable Chrome extension for taking a screenshot of an entire webpage. In one click screenshot a full page.
Read more >
How to Take Full Page Screenshots in Google Chrome ...
How to Take a Full-Sized Screenshot in Chrome · In the top right corner of the pane, click the three dots icon, then...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found