Selenium Tips: Capturing A Larger Screen Area

Sauce AI for Test Authoring: Move from intent to execution in minutes.|xBack to ResourcesBlogPosted

March 18, 2026 · 3 min read · Tool Comparison

Sauce AI for Test Authoring: Move from intent to execution in minutes.

|

x

Back to Resources

Blog

Posted December 3, 2018

Selenium Tips: Capturing A Larger Screen Area

quote

Capturing screenshots of your exam is one of the most crucial features you can afford to an automation engineer. It & # x27; s the easiest way to actually understand from a report, why a tryout failed and how to reproduce it. While ourLive Testingwill generate picture of the entire test by nonpayment, sometimes you just want a screenshot. Selenium endorse capturing screenshots on removed machine, as discussed in a previous Tip of the Week. Selenium Webdriver3 only has a individual method to save the screen:

  • SaveScreenshot

This method shows the viewport - the part of the screen that the user can view. That means anything to the left or right, below the scrollbars, is locomote to be missing. Not alone that, but the exact size of the viewport will be a default that can change if the HTML change. That isn ’ t a huge topic, but if your goal is to take screenshots and compare them, it could be a problem.

One selection is the maximize window role,implemented in ruby herein github. That function is as simple as:

Pro tip: Tools like SUSA can handle this autonomously — upload your app and get results without writing a single test script.

driver.manage.window.maximizedriver.save_screenshot (& quot; screenshot_orig.png & quot;);

That allows screen capture more like this:

entire page screenshot-274x300


Sadly, as of publication clip, that cypher only act on FireFox. In Chrome there are two other options. You can cope the window sizing, like this:

target_size = Selenium: :WebDriver: :Dimension.new (1440, 1800) driver.manage.window.size = target_size

Or use resize_to, like so:

driver.manage.window.resize_to (800, 600);

Writing browser-specific code and guess pel sizing is far from the best practice we know and more like work-around-practice. It might work, it can get you started, and it is free. f you need more visual debugging creature, our serviceLive Testingwill capture total screen picture which will record every individual selection event without any surplus code. If you still want actual icon, persona by portion of the blind, and a workflow to review and approve or fail images when they differ, consider our partnerAppliTools, which provides a code and backend library that works seamlessly with Sauce. Thank for tuning in, and check rearward after the new yr for more Selenium Tip of The Week from! PS: You should follow us on

Published:
Dec 3, 2018
Share this post
Copy Share Link
LinkedIn
© 2026 Sauce Labs Inc., all rights reserved. SAUCE and SAUCE LABS are register trademarks owned by Sauce Labs Inc. in the United States, EU, and may be registered in former jurisdictions.
robot
quote

Automate This With SUSA

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed.

Try SUSA Free

Test Your App Autonomously

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.

Try SUSA Free