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.

Selenium Grid screenshots are made by the browser running on a remote Grid node, not by the PC that starts the test. Different nodes can therefore produce different image dimensions or different-looking pages. Set the remote window size explicitly, read back the size the browser actually accepted, and measure the saved PNG itself; those are three separate checks.

Which “size” is different?

The word size can mean the browser window’s width and height, the page’s viewport, the screenshot’s pixel dimensions, or the image file’s storage size. They are related, but they are not interchangeable.

  • Requested window size: the dimensions your test asks WebDriver to set.
  • Returned window rectangle: the dimensions the remote browser reports after the request.
  • PNG dimensions: the width and height in pixels of the image actually saved by the test.
  • File size: the number of bytes the image occupies; compression and page content affect this independently of pixel dimensions.

WebDriver has distinct commands for managing a window rectangle and taking a screenshot. A request for a 1280 × 800 window is a test input, not proof that the browser returned that rectangle or that the PNG will be exactly 1280 × 800 pixels. Also, window dimensions are not necessarily identical to the page’s content viewport: browser chrome and the way the remote environment handles windows can matter.

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

Why the launching PC does not determine the screenshot

With Grid, the client sends WebDriver commands to a remote session. The browser executing those commands runs on the node assigned to that session. The screenshot represents that browser’s current browsing context; it is not automatically a capture of the monitor attached to the computer that launched the test.

Consequently, two runs from the same client can behave differently if they reach nodes with different display setups, browser builds, startup configuration, or headless settings. Even when both sessions accept the same requested window rectangle, their screenshot dimensions or rendered pixels may not match. Equal window dimensions are useful for controlling geometry, but do not by themselves guarantee identical rendering across browsers and environments.

Set, read back, and measure the screenshot

Use the same order on every Grid session: set a deliberate window size after creating the session, query the remote rectangle, capture the page, then inspect the PNG dimensions. This short Python pattern uses Selenium’s window and screenshot methods:

driver.set_window_size(1280, 800)
print("remote window:", driver.get_window_rect())
driver.save_screenshot("capture.png")

For a useful comparison, record the requested width and height, the returned rectangle, and the PNG width and height separately. Do this on each relevant session, not just on the local runner.

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

Runnable Grid example with dimension logging

The following example creates a remote Chrome session, opens a page, applies a requested size, and reports both the returned window rectangle and the PNG dimensions. Install Selenium and Pillow in the test environment first (pip install selenium pillow). Set GRID_URL to the reachable WebDriver endpoint for your Grid deployment.

import os
from pathlib import Path

from PIL import Image
from selenium import webdriver
from selenium.webdriver.chrome.options import Options


grid_url = os.environ["GRID_URL"]
options = Options()

# Add the same browser arguments and capabilities used by your normal tests.
driver = webdriver.Remote(
    command_executor=grid_url,
    options=options,
)

try:
    driver.get("https://example.com")

    requested_width, requested_height = 1280, 800
    driver.set_window_size(requested_width, requested_height)
    returned_rect = driver.get_window_rect()

    image_path = Path("grid-capture.png")
    driver.save_screenshot(str(image_path))

    with Image.open(image_path) as image:
        png_width, png_height = image.size

    print("requested window:", requested_width, "x", requested_height)
    print("remote window rectangle:", returned_rect)
    print("PNG dimensions:", png_width, "x", png_height)
finally:
    driver.quit()

Replace the example URL with the page under test. If your test uses another browser, pass the matching browser options and record that browser’s name and version. A successful call to save_screenshot only means the command returned a screenshot; it does not establish that its dimensions match another node’s output.

Compare the three parts of the environment

When two captures differ, compare the sessions that actually produced them. A local test process may dispatch separate sessions to different Grid nodes, so note the node and session associated with each artifact if your Grid setup exposes that information.

1. Geometry

  • Was the same width and height requested in both sessions?
  • Did both remote browsers return the same rectangle?
  • Do the PNG files themselves have the same pixel width and height?

If returned rectangles differ, check the requested values and whether the browser or node environment constrained the window. Do not infer the PNG dimensions from the client PC’s monitor resolution; inspect the actual files.

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.

2. Browser execution

  • Compare browser name and version, and driver version where available.
  • Check that both sessions use the same headed or headless mode.
  • Compare session capabilities and browser startup arguments.

These are diagnostic checks, not proof that a particular setting caused a mismatch. The details that matter depend on the browser and Grid deployment.

3. Node and artifact path

  • Identify the Grid node that handled each session and compare its display configuration.
  • Check whether an image-processing step resized, cropped, or converted either screenshot after WebDriver returned it.
  • Ensure the captures used equivalent page state and test data—for example, the same route, content, and point in the page’s loading sequence.

Keep this comparison focused: first establish whether the image dimensions differ, then determine whether the browser geometry or later artifact handling differs. If the dimensions match but the pages look different, investigate rendering and page state rather than treating it as a PNG-size mismatch.

Read the result as a diagnostic branch

  • Different returned rectangles: check that both tests made the same request, then investigate window-manager constraints and differences in node display setup.
  • Same returned rectangles, different PNG dimensions: compare browser and driver implementations, headless configuration, and any screenshot processing. These are leads to verify in your sessions, not universal causes.
  • Same PNG dimensions, different visual appearance: compare viewport behavior, device-scale settings, fonts, browser versions, application state, and content timing. This is a rendering-consistency problem even though the image files have matching dimensions.

The WebDriver protocol defines commands for window rectangles and screenshots, but matching requested geometry is not a promise of pixel-identical output from every browser, operating system, and driver combination.

Make cross-node comparisons more repeatable

For screenshot-based tests, treat environment details as part of the artifact rather than relying on the test runner’s machine description. Attach or log this information next to each capture:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Grid session and node identifier, if available.
  • Browser name and version; driver version where available.
  • Headless or headed mode and the relevant capabilities or startup arguments.
  • Requested window dimensions and the returned window rectangle.
  • PNG dimensions measured from the saved file.
  • Any later image processing, plus enough test context to identify the page state.

A bug report containing both geometry measurements is much easier to investigate than one that says only “the screenshot is the wrong size.” It shows whether the mismatch arose before capture, at capture, or while handling the resulting image.

Or skip the browser setup

If you need a clean screenshot of a public URL rather than an artifact from a specific Selenium Grid session, ScreenshotNeo offers a one-request capture. It is not a substitute when the test depends on the exact remote session, authenticated state, or browser interaction you need to verify.

For a URL-based capture, this cURL request saves a WebP image:

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

See the ScreenshotNeo API documentation for request options. Cookie and consent banners are accepted before capture, and more than 60 known consent platforms, newsletter popups, and chat widgets can be removed; each step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, with response headers indicating the page verdict and billing status. An MCP server provides screenshot and PDF tools for AI agents. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.

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

Sign up for 1,000 free screenshots a month—no card required.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common symptoms

The window size does not change to the requested value

Read the returned rectangle immediately after setting the size. If it differs, verify the request values and compare the session’s browser mode, node, and display setup. A maximize command is not a reliable cross-machine standard because available display bounds can differ; use an explicit requested size as the starting point and still verify the result.

The rectangle matches but the PNG dimensions do not

Confirm that you inspected the original file returned by the screenshot operation, not a resized derivative. Then compare browser and driver versions, headless settings, and the relevant node configuration between the sessions. The returned rectangle and screenshot are separate observations, so neither should be used as a proxy for the other.

The PNG dimensions match but visual tests fail

Look beyond width and height. Differences in fonts, device scale, browser version, page state, or when the capture happens can change rendered content without changing the image dimensions. Establish equivalent test data and capture timing before changing unrelated Grid settings.

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

Results vary between repeated runs

Record the node and session for each run, along with the returned rectangle and measured PNG dimensions. Then compare the actual execution environments and whether post-capture processing is involved. Without that session-level evidence, the cause cannot be reliably attributed to the launching PC or to a particular Grid setting.

Frequently asked questions

Does a larger PNG file in kilobytes mean it has larger dimensions?

No. Byte size depends on image content and compression as well as pixel dimensions. Compare the PNG’s reported width and height to answer whether its dimensions changed.

Should I use maximize instead of setting a fixed window size?

Maximizing depends on the display bounds available to the remote browser, which can vary between nodes. A fixed request followed by read-back is a more useful starting point for comparable geometry.

Frequently Asked Questions

Can the screenshot be of the PC that launched the Selenium test?

In a Grid session, the screenshot command is handled by the remote browser session. It does not automatically capture the launching PC’s monitor.

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

If both PNGs have the same dimensions, are they pixel-identical?

No. Matching dimensions establish only equal width and height; browser, font, device-scale, page-state, or timing differences can still change rendered pixels.

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.