Because Selenium’s window size and a screenshot’s pixel dimensions are different measurements. Set the browser window, check the page’s actual viewport after navigation, and inspect the saved image. Also confirm whether you need a screenshot of the visible viewport or of the full document.
First, identify what is the wrong size
“Wrong size” can describe three different problems:
As an Amazon Associate I earn from qualifying purchases.
- PNG dimensions: the file’s pixel width or height differs from what you expected.
- Visible content: the screenshot shows only part of the page, such as the top portion.
- Responsive layout: the site uses a mobile or tablet layout when you expected a desktop layout, or vice versa.
These symptoms have different causes. A screenshot can have the expected pixel dimensions but still show an unexpected responsive layout; a viewport screenshot can have the expected size while omitting content farther down the document.
Set the window, then measure the viewport
Selenium’s set_window_size(width, height) sets the current browser window’s dimensions. It is not a direct command to set the webpage’s rendered viewport to exactly those dimensions. Browser chrome, the operating system, or a virtual display can affect the space available to the page. Selenium also notes that screen resolution can affect how an application renders (Selenium window interactions).
#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
In Python, set the window and query the page’s viewport after navigation. The following example also records the actual saved PNG dimensions using Pillow (python -m pip install selenium pillow):
from pathlib import Path
from PIL import Image
from selenium import webdriver
options = webdriver.ChromeOptions()
# For a headed run, remove the next line.
options.add_argument("--headless=new")
driver = webdriver.Chrome(options=options)
try:
driver.set_window_size(1440, 1000)
driver.get("https://example.com")
viewport = driver.execute_script(
"return {width: window.innerWidth, height: window.innerHeight, "
"devicePixelRatio: window.devicePixelRatio}"
)
print("Requested window:", driver.get_window_size())
print("Rendered viewport:", viewport)
output = Path("page.png")
driver.save_screenshot(str(output))
with Image.open(output) as image:
print("Saved PNG pixels:", image.size)
finally:
driver.quit()
The example uses Selenium’s Python binding. Selenium documents window-size examples in several language bindings; check the corresponding binding’s API for syntax (window interaction documentation). Python’s API describes set_window_size as setting the current window’s width and height, and its screenshot method saves the current browsing context (Selenium Python API, version 4.50.0).
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
Interpret the measurements
- Viewport dimensions are unexpected: Check that the window-size command ran, inspect the size after navigation, and look for operating-system or virtual-display limits. A site’s responsive breakpoints respond to the page viewport, not simply to the dimensions you requested for the outer window.
- Viewport is right, PNG dimensions are unexpected: Investigate the browser and driver’s screenshot behavior and the runtime’s pixel scaling.
window.devicePixelRatiois useful diagnostic information, but the sources do not establish a universal Selenium rule tying it to screenshot dimensions; verify the result for your browser-driver combination. - PNG dimensions are right, layout is wrong: Compare the measured viewport with the width needed for the intended responsive breakpoint. Also check that the test is using the expected browser, headless mode, and display environment.
- Only the top of the page appears: You may have captured the visible viewport rather than the full document.
For repeatable comparisons, record the requested window size, measured viewport, saved image dimensions, browser and driver versions, operating system or container, headless setting, and screenshot method. Selenium’s documentation specifically cautions that screen resolution can affect rendering (Selenium window interactions).
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Choose viewport or full-document capture
A regular screenshot captures the current browsing context. That is suitable when you want the page as it appears in the visible browser area. It does not mean that the image automatically includes every element below the fold.
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.
If you need the whole document, use a full-page method supported by your browser-specific Selenium API. Selenium’s Firefox API documents get_full_page_screenshot_as_file(...) separately (Firefox WebDriver API). Do not assume that this Firefox-specific method is identically available in every browser binding. Confirm support in the API for the browser and language you actually run.
Troubleshoot common mismatches
The browser window is smaller than requested
Log driver.get_window_size() after setting the size. If the returned dimensions are not what you requested, check the browser’s window state, display resolution, and any container or virtual-display configuration. Window resizing and fullscreen behavior are browser-environment dependent; compare results in the same runtime you use for screenshots.
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
The page uses the wrong responsive layout
Read window.innerWidth after navigation and compare it with the layout width you intend to test. If the viewport is narrower than expected, investigate the window configuration and display limits rather than assuming the PNG file’s dimensions determine the CSS layout.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
The image is clipped vertically
Check whether your code calls the standard screenshot method or a browser-supported full-document method. A viewport screenshot and a full-page screenshot have different scopes; choose the one the test requires.
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.
Results differ between local and CI runs
Hold the environment steady and log the browser and driver versions, OS or container, headless mode, requested window size, measured viewport, and output image dimensions. Different screen resolutions can affect rendering, so compare like with like rather than relying on a window-size request alone.
Viewport and image pixel dimensions do not line up
Record window.devicePixelRatio and inspect the actual PNG dimensions. Pixel scaling is a diagnostic possibility, not a universal Selenium explanation; the behavior must be checked with the specific browser and driver in use.
Or skip the browser setup
If you need a screenshot of a public URL without configuring WebDriver, ScreenshotNeo is a website screenshot API. A single GET request can return an image or PDF. For example, save a WebP capture of a page:
Free tools Windows power users keep installed
One-click scans. No signup required.
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. It removes known cookie and consent banners, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers report the page verdict and billing status. ScreenshotNeo also offers an MCP server with tools for AI agents, and its free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots. Sign up for free: 1,000 screenshots a month, no card required.
Frequently Asked Questions
Does Selenium’s window-size setting set the page viewport?
No. It sets the browser window dimensions. Measure the rendered page viewport separately after navigation.
Does a normal Selenium screenshot include the entire webpage?
Not necessarily. A regular screenshot captures the current browsing context; full-document capture requires a supported browser-specific method.
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.




