Yes—you can capture a full page while Chrome or Firefox remains visible. The browser is headed by default when you create a normal Selenium driver; the important part is choosing a full-document capture method rather than relying on Selenium’s ordinary viewport screenshot. In Firefox, use its full-page WebDriver method. In Chrome, send the DevTools Protocol command Page.captureScreenshot with captureBeyondViewport enabled. Both examples below save a PNG and close the browser reliably.
What “without headless mode” means
Headed mode means the browser window is visible on your desktop. Selenium does not require headless mode to take screenshots: create a regular WebDriver instance and do not add a headless option to the browser configuration. The browser can still navigate, wait for content, and write an image file.
There are two separate questions: whether the browser is visible, and whether the screenshot contains the full document. A visible browser can still produce a screenshot limited to its current window. Select the full-page API for the browser you use.
Firefox: use Selenium’s full-document screenshot method
Firefox’s Python WebDriver API provides get_full_page_screenshot_as_file(), which saves a full-document PNG. It also provides related full-page methods for saving to a supplied file, returning PNG bytes, or returning base64 data. This is a Firefox-specific API, not a generic method available in the same way across all WebDriver browsers. See the Selenium Firefox WebDriver API documentation.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →#1 Best Overall
from pathlib import Path
from selenium import webdriver
output = Path("page.png").resolve()
driver = webdriver.Firefox() # Visible browser; no headless option
try:
driver.get("https://example.com/long-page")
saved = driver.get_full_page_screenshot_as_file(str(output))
if not saved:
raise OSError(f"Screenshot could not be written to {output}")
print(f"Saved full-page screenshot to {output}")
finally:
driver.quit()
Install Selenium with python -m pip install selenium, and ensure a compatible Firefox browser and WebDriver are available. Selenium’s driver management behavior and installation requirements can vary by Selenium version and local environment; if driver startup fails, consult the Selenium driver installation guide.
The file method returns a success value, so check it rather than assuming a file was written. Use an absolute output path when diagnosing file-location confusion: a relative path is resolved from the process’s working directory, which may differ from the directory containing your Python script.
Chrome: capture beyond the viewport through CDP
For headed Chrome, Selenium can send Chrome DevTools Protocol (CDP) commands. The CDP Page.captureScreenshot command supports captureBeyondViewport and fromSurface; the response contains base64-encoded image data. Decode that data and write the PNG bytes to disk. See the Chrome DevTools Protocol Page.captureScreenshot reference.
import base64
from pathlib import Path
from selenium import webdriver
output = Path("page.png")
driver = webdriver.Chrome() # Visible browser; do not add --headless
try:
driver.get("https://example.com/long-page")
result = driver.execute_cdp_cmd("Page.captureScreenshot", {
"format": "png",
"fromSurface": True,
"captureBeyondViewport": True,
})
output.write_bytes(base64.b64decode(result["data"]))
print(f"Saved screenshot to {output.resolve()}")
finally:
driver.quit()
This is a Chromium/CDP approach, rather than a portable WebDriver full-page method. CDP commands and behavior can vary with browser versions and implementations. Use a Selenium and Chrome combination that exposes execute_cdp_cmd; if you switch to a different browser, use that browser’s supported full-page mechanism rather than assuming this command is universal.
Rank #2
For workflows that need to inspect the document dimensions or capture a specific region, CDP also has Page.getLayoutMetrics, which reports layout information including the scrollable CSS content size. The protocol reference documents its fields. The basic full-page example does not need a manually calculated clip.
Why save_screenshot() often misses the rest of the page
Selenium’s generic save_screenshot() and get_screenshot_as_file() methods are documented as capturing the current window. They are useful for viewport screenshots, but should not be treated as guaranteed full-document capture in headed Chrome. See the Selenium WebDriver API documentation.
Making the browser window taller or resizing it does not reliably turn a viewport screenshot into a full-page screenshot. A long document can remain clipped at the visible viewport, even if the browser window was enlarged. If the goal is the whole document, use Firefox’s dedicated method or Chrome’s CDP capture command.
Which method should you choose?
| Approach | Browser | Visible session | Output | Main limitation |
|---|---|---|---|---|
| Firefox full-document WebDriver method | Firefox | Yes | PNG file, bytes, or base64 through Firefox-specific methods | Browser-specific API; browser and driver compatibility still matters. |
CDP Page.captureScreenshot |
Chromium browsers exposing CDP | Yes | Base64 image data, decoded to PNG in the example | CDP is version-sensitive, and page-specific waits may be needed. |
Generic save_screenshot() |
WebDriver implementations | Yes | PNG file | Captures the current window; tall pages may be clipped. |
| Scroll and stitch | Browsers that can be scripted | Yes | Combined image assembled from viewport shots | Sticky headers, floating elements, and dynamic content can duplicate, crop, or omit pixels. |
Choose Firefox’s native full-page method when Firefox is acceptable and you want the shortest documented path. Choose CDP when you need to stay with Chrome or another Chromium browser exposing the command. Use ordinary WebDriver screenshots for viewport captures, not as a full-page guarantee. Scroll-and-stitch is a fallback when no suitable full-page capture API is available, but requires handling layout artifacts yourself.
Prepare the page before capturing it
A full-page screenshot only captures the rendered state available at the time of the call. It does not guarantee that every image or dynamically inserted section has loaded. Pages that load content as the visitor scrolls may need page-specific scrolling and waits before capture. There is no universal sleep duration that guarantees readiness across websites; wait for the condition that matters on your target page.
- Navigate: call
driver.get(url)for the exact page you need. - Wait for a meaningful state: use an expected condition, a known selector, or site-specific readiness signal when the page’s content is not ready at navigation completion. Selenium’s waits documentation explains explicit waits.
- Trigger lazy content if needed: if the site loads images or sections only as they approach the viewport, scroll through the relevant regions and wait for them to appear before taking the final capture.
- Capture and inspect: open the resulting PNG and check the top, middle, and bottom for missing sections, unloaded images, or layout shifts.
Sticky headers and floating controls can behave differently during scrolling or full-document rendering. A stitched image is particularly prone to duplicating those elements; even native full-page capture should be checked on the target site because page behavior is not identical across implementations.
When scroll-and-stitch is the fallback
A manual method takes a viewport screenshot at each scroll position and combines the images. It can be made to work for simple, static pages, but it is not equivalent to a browser-native full-page capture. Content may move between screenshots, fixed headers can recur in every slice, and images or animations may load at different times. Exact stitch geometry also depends on viewport and device-pixel scaling.
Prefer Firefox’s full-document method or Chrome CDP when available. If stitching is unavoidable, disable or account for sticky elements, use overlapping capture regions, wait for content at each position, and validate the final image visually. Do not rely on a stitched result as a faithful record of a page with live updates or complex scrolling behavior.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteCommon problems and fixes
The browser window is not visible
Check the driver setup for a headless argument or environment configuration that launches headless Chrome or Firefox. Remove that setting and create a normal driver. On a machine without a graphical display, a headed browser may require a display server; omitting --headless alone cannot create a desktop session where none exists.
The image contains only the visible screen
The code likely called save_screenshot() or get_screenshot_as_file(), which capture the current window, or used a browser path that does not implement full-page capture. Use the Firefox full-document method or the Chrome CDP command with captureBeyondViewport set to True.
Chrome reports an unknown command or parameter
Confirm that the driver is Chromium-based and that the Selenium driver exposes CDP command execution. Check that the installed browser and driver are compatible, then consult the protocol documentation for the browser version in use. CDP is not a cross-browser WebDriver command.
The screenshot file is missing or empty
Print the resolved output path, verify that its parent directory exists and is writable, and check the Firefox method’s returned success value. For Chrome, confirm that the response contains data and that the code decodes and writes it as bytes.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Images or lower sections are blank
The page may use lazy loading or asynchronous content. Wait for a page-specific readiness condition, scroll through content that loads on demand, and capture again. Inspect whether the site requires interaction or authentication before the expected content is rendered.
The result has duplicated headers or clipped elements
This often indicates scroll-and-stitch artifacts, especially with sticky headers, floating widgets, or content that changes while scrolling. Prefer the browser-specific native route, or adjust the page state and stitching logic and inspect every seam.
The browser stays open after an error
Keep the capture work inside a try block and call driver.quit() in finally, as in the examples. This shuts down the browser even if navigation, capture, decoding, or file writing raises an exception.
Best Value
Or skip the browser setup
If you need a screenshot from code but do not need a locally visible browser, ScreenshotNeo provides a website screenshot API and MCP server for developers. A single GET request can return a PNG, JPEG, WebP, or PDF. Its clean-shot options accept cookie or consent banners and remove 60+ known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the page verdict and billing status in headers. AI agents can use its MCP server tools, including take_screenshot, get_page_info, and capture_pdf.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallcurl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com/long-page -o shot.webp
See the ScreenshotNeo API documentation for request options and response details. The free plan includes 1,000 screenshots per month with no card required; paid plans start at $5 for 3,000 screenshots. Sign up for the free plan.
Frequently Asked Questions
Can Selenium take a full-page screenshot while Chrome is visible?
Yes. Use Chrome’s CDP `Page.captureScreenshot` command with `captureBeyondViewport` enabled; a headless browser is not required.
Does Selenium’s `save_screenshot()` capture the whole page?
It is documented as a current-window screenshot method, so it is not a reliable full-document method for tall pages.
Will a full-page capture automatically load every lazy image?
Not necessarily. Scroll or wait for the page-specific content to load before capture, then inspect the PNG.
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.




