What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

Use Selenium’s Ruby WebDriver to navigate to a page, wait until the required state is visible, and call driver.save_screenshot("tmp/example.png"). That writes a PNG of the current browser viewport. For image data without a file, use driver.screenshot_as(:png) or driver.screenshot_as(:base64). Full-page capture is available only when the active driver supports it.

Minimal Selenium Ruby screenshot

Install the Selenium Ruby gem, make a browser driver available, then capture after navigation. The screenshot records the browser state at the instant the method runs, so navigation, waits and interactions must come first.

require "selenium-webdriver"

driver = Selenium::WebDriver.for :chrome
begin
  driver.navigate.to "https://example.test"
  driver.save_screenshot("tmp/example.png")
ensure
  driver.quit
end

save_screenshot takes a path and saves a PNG. The Ruby TakesScreenshot API describes it as: “Save a PNG screenshot of the viewport to the given path.” Create the tmp directory (or choose another writable directory) before running the script, and use a filename ending in .png. Selenium warns when the extension does not match PNG.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What the basic call captures

Viewport, not automatically the whole document

The default image is the current viewport: the portion of the page visible in the browser window. It reflects the active URL, scroll position, zoom, responsive layout, cookies, overlays and any interaction that has happened before the call.

#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents

Capture timing is part of the result

A screenshot taken immediately after navigate.to can show a loading state, an empty component or a consent dialog. Wait for the page or component that matters, perform clicks or scrolling, and only then capture. Selenium does not infer which visual state you intended.

Always close the driver

The ensure block runs when the script succeeds or raises an exception, preventing an orphaned browser process. In a test suite, keep the same cleanup pattern around every driver session.

Wait for the state you want to document

Use the wait and interaction mechanisms already present in your Selenium test, then capture. For example, this waits until a result element is displayed before writing the image:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
require "selenium-webdriver"

driver = Selenium::WebDriver.for :chrome
wait = Selenium::WebDriver::Wait.new(timeout: 10)

begin
  driver.navigate.to "https://example.test/search"
  field = wait.until { driver.find_element(name: "q") }
  field.send_keys("ruby")
  field.submit

  wait.until { driver.find_element(css: "[data-testid='results']").displayed? }
  driver.save_screenshot("tmp/search-results.png")
ensure
  driver.quit
end

The selector and URL are examples; replace them with elements in your application. A useful rule is to wait for a stable, meaningful condition (such as a results container being displayed), rather than adding an arbitrary delay. If an animation or late image still changes the composition, wait for the specific element or state that signals completion.

Save a full-page screenshot when the driver supports it

Pass full_page: true to request a document-length image:

driver.save_screenshot("tmp/full-page.png", full_page: true)

This option is conditional, not universal. Selenium checks whether the active driver provides full-page screenshot support and raises Selenium::WebDriver::Error::UnsupportedOperationError when it does not. The API wording is that “full_page allows taking full page screenshots if supported.” Therefore, treat a full-page request as a capability you verify in the browser and driver combination used by your project, not as a guarantee of every Selenium session.

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors

Handle unsupported full-page capture

If the call raises UnsupportedOperationError, fall back to the normal viewport image, use a driver that implements full-page capture, or capture the page in sections by scrolling and saving several viewport images. Do not silently label a viewport image as full-page; the two outputs have different coverage.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Return PNG bytes or Base64 instead of writing a file

When a test uploads an artifact, embeds an image, or sends it to another service, use screenshot_as:

require "selenium-webdriver"

driver = Selenium::WebDriver.for :chrome
begin
  driver.navigate.to "https://example.test"

  png_bytes   = driver.screenshot_as(:png)
  base64_data = driver.screenshot_as(:base64)

  File.binwrite("tmp/from-bytes.png", png_bytes)
  File.write("tmp/screenshot.base64", base64_data)
ensure
  driver.quit
end

screenshot_as(:png) returns the PNG data, while screenshot_as(:base64) returns Base64 text. Neither call writes a file by itself. The documented formats are :png and :base64; another format raises UnsupportedOperationError. Use binary mode for PNG bytes and text mode for Base64.

Ruby call Output Scope Best fit
save_screenshot(path) PNG file Current viewport CI artifacts, local inspection and archival
save_screenshot(path, full_page: true) PNG file Whole page only if supported Long-page documentation when the driver capability is present
screenshot_as(:png) PNG bytes Current viewport Uploading or processing in Ruby without an intermediate file
screenshot_as(:base64) Base64 text Current viewport Embedding in HTML or transporting through a text-only API

Capture one element rather than the viewport

Selenium’s TakesScreenshot interface is also included by element objects. When the binding and active driver support element capture, save the rendered element image directly:

require "selenium-webdriver"

driver = Selenium::WebDriver.for :chrome
wait = Selenium::WebDriver::Wait.new(timeout: 10)

begin
  driver.navigate.to "https://example.test/dashboard"
  card = wait.until { driver.find_element(css: ".summary-card") }
  card.save_screenshot("tmp/summary-card.png")
ensure
  driver.quit
end

Element capture is driver-dependent in the same way as other optional screenshot capabilities. Verify it with the browser and driver versions used by your test environment. If unsupported, scroll the element into view and use a viewport capture, or capture the surrounding page instead.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Make captures repeatable in tests and services

Use deterministic destinations

Build a path that identifies the test, URL or state, and ensure its parent directory exists. Avoid writing multiple parallel tests to the same filename. A timestamp or test identifier prevents one failure from overwriting another artifact.

Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

Check the file and bytes

After a file capture, verify that the path exists and has non-zero size before publishing it as a test artifact. For in-memory captures, treat the return value as binary data for :png; do not call text encodings on it.

Keep browser state explicit

Cookies, authentication, viewport dimensions, scroll position and open overlays all affect pixels. Establish the state in the script or test setup, then capture. A screenshot is evidence of that exact state, not a fresh server-side rendering.

Protect sensitive output

PNG files and Base64 strings can contain account data, tokens displayed in a page, personal information or internal URLs. Restrict artifact access and remove temporary captures when they are no longer needed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Common failures and fixes

Symptom Likely cause Fix
Errno::ENOENT or a missing image The destination directory does not exist. Create the directory first (for example, FileUtils.mkdir_p("tmp")) or provide an existing writable path.
Permission denied The Ruby process cannot write to the selected location. Choose a directory owned by the process and check its permissions; do not rely on a protected system path.
The page is blank or still loading Capture ran before the required state appeared. Wait for a meaningful element or state, then call the screenshot method.
The image contains a cookie dialog, popup or chat panel Those overlays were present in the browser state. Accept or dismiss them through Selenium before capture, or hide them in your test setup if that reflects the intended state.
UnsupportedOperationError with full_page: true The active driver does not implement full-page screenshots. Use a supported driver, take a viewport image, or collect multiple scrolled captures.
Unsupported format from screenshot_as A format other than :png or :base64 was requested. Use one of the two documented symbols.
Element screenshot fails The binding or driver lacks element-level capture, or the element is not ready. Wait for the element to be displayed, verify capability, and fall back to a viewport capture if necessary.
The file is overwritten by another test Parallel jobs share one filename. Include a unique test or job identifier in each destination path.

Performance, reliability and cost considerations

Performance

A screenshot adds image encoding and, for full-page capture, potentially a much larger bitmap. Capture only at checkpoints that provide diagnostic or product value. Prefer bytes when the next step is an upload, because avoiding an intermediate file can simplify I/O; prefer files when your CI system collects artifacts automatically.

Reliability

The most reliable sequence is: create the driver, navigate, wait for the target state, interact or scroll as needed, capture, and quit in ensure. Keep full-page and element captures behind capability checks. A screenshot cannot repair a failed navigation, a blocked resource or a page that never reached the expected state; report those failures separately.

Cost

With Selenium, the screenshot operation itself is a local browser action. Your practical costs are the machine or CI time, browser processes, storage and any grid infrastructure you operate. Full-page images and retained artifacts consume more storage than viewport PNGs. If you need to capture many public URLs without maintaining browsers, an API can move that operational work to a service.

Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server for developers. One GET request returns a PNG, JPEG, WebP or PDF. Before capture it accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups and chat widgets; each cleanup step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a direct call, see the ScreenshotNeo API documentation:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

The same request from Ruby can be made with any HTTP client:

require "net/http"
require "uri"

uri = URI("https://api.screenshotneo.com/v1/shot")
uri.query = URI.encode_www_form(access_key: "YOUR_API_KEY", url: "https://stripe.com")
response = Net::HTTP.get_response(uri)
File.binwrite("shot.webp", response.body)

Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo also supports full-page capture with lazy images loaded, CSS-selector element capture, dark mode, 12 device presets and custom viewports, retina scale, PDF paper and page-range controls, custom CSS and JavaScript, pre-capture clicks, selector or network-idle waits, request and resource blocking, custom headers, cookies, user agents and Authorization, timezone and geolocation, transparent backgrounds, resizing, configurable-TTL caching, signed image links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, a usage API and an OpenAPI specification. Its parameter names match those used by other screenshot APIs, which can simplify migration.

An MCP server provides take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients. Plans include 1,000 screenshots per month free with no card, Starter at $5 for 3,000, Growth at $15 for 15,000, Pro at $39 for 60,000, Scale at $99 for 250,000 and Business at $249 for 1,000,000; yearly billing gives two months free, and every feature is on every plan. Create a free ScreenshotNeo account to get the 1,000 monthly screenshots without a card.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

FAQ

Does save_screenshot create JPEG or WebP?

No. Selenium’s Ruby screenshot method writes PNG data. Use an image-processing step afterward if another format is required.

Can I call the screenshot method before navigation?

You can call it, but it will capture whatever state the newly created browser currently displays. Navigate and wait for the intended page before treating the output as useful evidence.

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.

Is Base64 the same image as PNG bytes?

It represents the same PNG image encoded as text. Decode the Base64 value when a binary file or byte stream is required.

Why does a full-page image work locally but fail in CI?

Full-page support depends on the active browser driver. Different environments can expose different capabilities, so check support in the CI driver rather than assuming local behavior transfers unchanged.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Frequently Asked Questions

Does save_screenshot create JPEG or WebP?

No. Selenium’s Ruby screenshot method writes PNG data; convert it afterward if another format is needed.

Can I call the screenshot method before navigation?

It will capture the browser’s current state, which may be a blank or startup page. Navigate and wait for the intended state first.

Is Base64 the same image as PNG bytes?

Base64 is the same PNG data represented as text; decode it when a binary stream is required.

Why can full-page capture work locally but fail in CI?

Full-page support is driver-dependent, and the CI browser-driver combination may not provide that capability.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.