Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
If a headless Firefox screenshot has different pixel dimensions from the size you requested, check three things separately: Selenium’s browser-window size, Firefox’s headless virtual-display size, and whether you captured the current window or the full document. Set and log the Selenium size, inspect the saved PNG itself, and confirm the capture method matches the image you want. Those checks diagnose the mismatch without assuming that one historical report describes every Firefox setup.
Why the requested size and screenshot size can differ
“Resolution” can mean different things in a Selenium test. The size returned by driver.get_window_size() is the browser window’s reported width and height. Firefox’s headless virtual display has its own documented dimensions. The saved image has actual pixel dimensions, and its height also depends on whether you captured the current window or the whole document. These values are related, but checking one does not prove the others match.
A 2020 geckodriver issue report illustrates the distinction: its reporter requested and read back a 1024×768 window, but the PNG from save_screenshot() measured 1024×694. That report was for macOS 10.15.4, Firefox 78.0.2 (64-bit), geckodriver 0.26.0, Selenium 3.141.0, and Python 3.7. It is a specific historical reproduction—not evidence that current Firefox always loses 74 pixels or that the same cause applies to another environment. See the Mozilla geckodriver issue report for that context.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsMozilla documents MOZ_HEADLESS_WIDTH and MOZ_HEADLESS_HEIGHT as controls for the dimensions of Firefox’s no-op virtual display. Selenium separately documents setting and reading a window size. Keep those controls distinct: the available documentation does not say that a Selenium window-size call and Firefox’s headless display variables are interchangeable in every setup.
#1 Best Overall
- 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
Set and record Selenium’s window size
Set the intended size explicitly, then read it back after navigation or other setup that could affect the window. Selenium’s documented Python pattern is driver.set_window_size(width, height); driver.get_window_size() retrieves the current dimensions.
from selenium import webdriver
# Create the Firefox driver using your existing headless configuration.
driver = webdriver.Firefox()
try:
driver.set_window_size(1440, 900)
driver.get("https://example.com")
window_size = driver.get_window_size()
print("Selenium window size:", window_size)
driver.save_screenshot("current-window.png")
finally:
driver.quit()
This example demonstrates the sizing and diagnostic calls, not a prescribed Firefox or geckodriver installation procedure. Keep the headless configuration used by your project and record its versions when investigating a discrepancy. If your installed Selenium binding or project uses different setup conventions, follow that binding’s API documentation; the issue described here concerns the dimensions, not a universal driver-construction recipe.
Check Firefox’s headless virtual display separately
When Firefox runs headlessly, determine whether your setup needs explicit virtual-display dimensions. Mozilla documents the environment variables MOZ_HEADLESS_WIDTH and MOZ_HEADLESS_HEIGHT for this purpose. Set them before starting Firefox, then create the driver and check its reported window size. Changing an environment variable after the browser process has started cannot configure that already-running process.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Rank #2
- 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
import os
from selenium import webdriver
# Set before Firefox starts. Choose values for your test.
os.environ["MOZ_HEADLESS_WIDTH"] = "1440"
os.environ["MOZ_HEADLESS_HEIGHT"] = "900"
driver = webdriver.Firefox()
try:
driver.set_window_size(1440, 900)
driver.get("https://example.com")
print("Selenium window size:", driver.get_window_size())
driver.save_screenshot("current-window.png")
finally:
driver.quit()
The environment variables and Selenium call address distinct documented sizing concepts. This example sets both deliberately so you can observe their behavior in your own supported configuration; it does not establish that both are required or that they override each other identically in every Firefox, geckodriver, and Selenium version combination.
Verify the PNG instead of inferring its size
A successful screenshot call only tells you that a file was written; it does not establish that its pixel dimensions equal the values Selenium reported. Inspect the PNG’s width and height directly. The following small Python function reads those dimensions from the PNG header using the standard library, without an image package:
import struct
def png_dimensions(path):
with open(path, "rb") as image:
header = image.read(24)
if len(header) < 24 or header[:8] != b"x89PNGrnx1an" or header[12:16] != b"IHDR":
raise ValueError(f"Not a valid PNG header: {path}")
return struct.unpack(">II", header[16:24])
print("PNG pixel dimensions:", png_dimensions("current-window.png"))
Compare this output with the logged window size, keeping in mind that one describes Selenium’s reported window and the other describes the file. If your target is an exact viewport-sized image, also make sure the selected capture method is intended to capture the current window.
Rank #3
- 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.
Choose current-window or full-document capture
The ordinary WebDriver screenshot API captures the current window. A full-document screenshot has a different scope: it is intended to include the page beyond the visible viewport. Firefox’s Python API documents full-document screenshot methods, including get_full_page_screenshot_as_file. A taller full-page image is therefore not necessarily a window-sizing failure.
Free tools Windows power users keep installed
One-click scans. No signup required.
from selenium import webdriver
driver = webdriver.Firefox()
try:
driver.set_window_size(1440, 900)
driver.get("https://example.com")
# Current-window capture:
driver.save_screenshot("viewport.png")
# Firefox full-document capture:
driver.get_full_page_screenshot_as_file("full-document.png")
finally:
driver.quit()
Use the first method when the deliverable should correspond to the current browser window. Use the Firefox full-document method when the deliverable should cover the document beyond the visible area. Check the dimensions of each output separately; the two files are not expected to have the same height when the document extends below the viewport.
A practical diagnostic sequence
- Record the environment. Note the operating system, Firefox version, geckodriver version, Selenium version, and language binding. Historical reports are tied to specific environments, so these details help distinguish a reproducible configuration issue from an assumption based on an older example.
- Set and read back the window size. Call Selenium’s supported window-size method with the intended width and height, then log the result from
get_window_size(). - Check headless display dimensions. If the Firefox session is headless, review whether explicit
MOZ_HEADLESS_WIDTHandMOZ_HEADLESS_HEIGHTvalues are appropriate for your configuration. Set environment variables before launching Firefox. - Capture the intended scope. Decide whether you want the current window or the full document, and use the corresponding documented API.
- Measure the output file. Inspect the saved PNG’s pixel dimensions, rather than treating Selenium’s reported window size as proof of the image size.
- Reduce persistent problems to a reproduction. Keep the target page, sizing calls, screenshot method, environment details, and observed dimensions together. The historical issues do not establish one current fix that applies to all setups.
Common symptoms and what to check
| Symptom | What it may indicate | Next check |
|---|---|---|
get_window_size() reports the requested dimensions, but the PNG differs |
The reported window size and saved image dimensions are different measurements; the capture scope or headless display may also matter. | Measure the PNG, check headless display settings, and confirm the screenshot method. |
| The screenshot is taller than the visible area | You may have captured the full document rather than the current window. | Use the current-window capture when viewport/window output is the goal. |
The size remains unexpected after calling set_window_size |
The requested Selenium window size alone may not settle how a headless session is configured. | Read back the window size, inspect the PNG, and check the documented headless display variables. |
| A past workaround does not change a newer setup | The older issue may be version- or environment-specific; it is not a compatibility guarantee. | Record current versions and make a minimal reproduction before attributing the cause. |
Firefox command-line sizing is a different path
Mozilla’s Firefox command-line reference documents --window-size width[,height] for use with Firefox’s --screenshot command. Its scope is that command-line screenshot workflow. Do not assume that this option is a drop-in replacement for Selenium’s window API or the headless display environment variables; the documented controls apply to different interfaces.
Rank #4
- 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
Or skip the browser setup
If your actual task is to obtain a page screenshot rather than test Firefox’s rendering behavior, ScreenshotNeo offers a one-request screenshot API. It accepts a URL and returns PNG, JPEG, WebP, or PDF. This is an alternative capture workflow, not a Selenium fix or a way to reproduce a Firefox-specific test.
For request parameters and response details, see the ScreenshotNeo documentation.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
ScreenshotNeo removes cookie and consent banners, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and the response indicates the page verdict and billing status in headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents using Claude, Cursor, or another MCP client. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots.
Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month with no card.
Best Value
- 【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.
What the evidence does not establish
The 1024×768 versus 1024×694 discrepancy comes from one 2020 report; it does not establish how often the issue occurs, a universal 74-pixel reduction, or a single cause shared by current environments. A separate historical geckodriver full-screen report is likewise an example, not current compatibility guidance. Treat both as prompts to capture your own versions and dimensions, not as proof of a present-day Firefox defect.
Frequently Asked Questions
Does a 1024×768 window always produce a 1024×694 headless Firefox screenshot?
No. Those dimensions were reported in one 2020 setup; they are not a general rule for Firefox.
Can ScreenshotNeo reproduce a Selenium Firefox rendering test?
No. It provides a separate screenshot API and MCP workflow; it does not substitute for testing Firefox-specific behavior in Selenium.
Quick Recap
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.

