Capture Fullpage Screenshot
See original GitHub issueThis 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:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This functionality would be nice, but I see various problems in the proposed implementation:
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.