Set the browser window size in Selenium, then read the live dimensions back before saving the screenshot. For headless Chrome, pass a window-size argument when Chrome starts and set the size again through WebDriver. If your Jenkins Linux VM runs a headed browser, configure its Xvfb display separately: the browser window and virtual display are two different settings.
Set and verify the Selenium browser window size
Choose dimensions that match the viewport your test is meant to cover; there is no single resolution that suits every visual test. Selenium can resize the current browser window, report its dimensions, and save a screenshot. Checking the live size makes the setup observable instead of relying only on a startup option.
Python with headless Chrome
This example starts Chrome with a 1440 × 900 window, sets that size through WebDriver after the session opens, prints the dimensions WebDriver reports, and saves a screenshot to the current working directory.
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument("--headless")
options.add_argument("--window-size=1440,900")
driver = webdriver.Chrome(options=options)
try:
# Set explicitly after session creation, then verify the live window.
driver.set_window_size(1440, 900)
actual = driver.get_window_size()
print(f"Browser window: {actual['width']}x{actual['height']}")
saved = driver.save_screenshot("artifacts/page.png")
if not saved:
raise RuntimeError("WebDriver did not save the screenshot")
finally:
driver.quit()
Create the artifacts directory before running this script, or change the path to a directory that already exists. The printed dimensions are the browser window dimensions reported by WebDriver; they are not proof by themselves that the screenshot has the intended content or that two different VM images will render pixel-identically.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errors#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
What the dimensions mean
- WebDriver window size: The browser window dimensions controlled and reported by Selenium. This is the setting to verify for the browser session.
- Xvfb screen size: The virtual framebuffer dimensions used when a headed browser needs a display on a Linux Jenkins agent. Xvfb’s setting uses width, height, and color depth in
WxHxDform.
Keep the display large enough for the browser window when using Xvfb. Configuring one value does not automatically set or verify the other.
Configure Xvfb for a headed browser in Jenkins
Use the Jenkins Xvfb Pipeline wrapper when the Linux agent needs a virtual display for a headed browser. The node must have the Xvfb installation configured for the plugin. In the screen value, the third number is color depth, not a second height setting.
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
wrap([$class: 'Xvfb', screen: '1440x900x24']) {
sh 'pytest'
}
This wraps the build work in a virtual display configured as 1440 × 900 at 24-bit color depth. Match it to the needs of your test and browser window rather than treating it as a universal visual-testing resolution. The Jenkins plugin documentation notes that explicitly assigned display names can clash; use automatic display assignment where supported if concurrent builds encounter that issue.
Save screenshots as Jenkins artifacts
A screenshot written on the VM is useful only if the job can retain or publish it. Save to a path inside the workspace, ensure its parent directory exists, and configure your Pipeline or job to archive that path. Selenium’s screenshot-to-file method reports whether the file write succeeded; check its return value and confirm the file appears among the retained build artifacts.
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.
Diagnose resolution and screenshot mismatches
The screenshot has the wrong dimensions
- Print
driver.get_window_size()after the browser starts. If it differs from the requested size, set the size through WebDriver and inspect the value again. - For headless Chrome, confirm the startup argument is passed through
ChromeOptions. Browser version and run mode can affect argument behavior, so use the live-session check rather than assuming the option was honored. - If using a headed browser under Xvfb, inspect both the WebDriver-reported window dimensions and the configured Xvfb
screendimensions.
The screenshot differs from the visual baseline
- Compare the actual WebDriver window size, headless versus headed mode, and Xvfb dimensions where applicable.
- Confirm what the screenshot method captures. Selenium’s current-window screenshot is not synonymous with a full-page capture.
- Keep the browser version and VM image consistent across baseline creation and CI runs where possible. The documented settings do not guarantee pixel-identical rendering across different VM images or browser releases.
No screenshot is retained
- Check that the destination directory exists and that the agent can write to it.
- Use a workspace-relative path, check the screenshot method’s success result, and verify that the Jenkins job archives the same path.
Performance, reliability, and cost considerations
The cited browser and Jenkins settings establish how to choose browser-window and virtual-display dimensions; they do not establish a performance benefit, reliability percentage, or universal resolution. Larger dimensions may change the page layout and the amount of content visible, so select a size based on the test’s intended viewport and keep it consistent with the visual baseline. Reliability comes from making the browser mode, live window size, display configuration, and artifact path explicit and checking them in each build.
This configuration uses Selenium, Chrome, Jenkins, and—when required—Xvfb; it does not require a screenshot service. If you want an API-based capture instead, ScreenshotNeo is a separate option described below.
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
For a standalone website capture rather than a Selenium test session, ScreenshotNeo accepts one GET request with a URL and returns an image or PDF. The cURL example below saves a WebP screenshot; see the ScreenshotNeo API documentation for options.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo accepts cookie banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers report the page verdict and billing status. Its MCP server provides screenshot tools for AI agents, and the free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots.
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 →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Sign up for ScreenshotNeo’s free plan.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Frequently Asked Questions
Does changing Xvfb resolution also resize the Selenium browser window?
No. Xvfb configures the virtual display; use Selenium’s window-size APIs to control and verify the browser window.
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.
Does Selenium’s current-window screenshot automatically capture the full page?
No. A current-window screenshot should not be assumed to include the entire document; distinguish it from a full-page capture.
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.

