Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk6 min

How to Capture a Full-Page Screenshot with Selenium When a Page Has Sticky Navigation

Use Firefox’s full-page Selenium API or Chromium CDP beyond-viewport capture, then inspect and adjust sticky navigation only when the output requires it.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use a browser-specific full-page capture method: Selenium’s Python Firefox driver provides full-document screenshot methods, while Chromium can use the Chrome DevTools Protocol (CDP) Page.captureScreenshot command with captureBeyondViewport enabled. A standard WebDriver screenshot captures the current browsing context, so it should not be assumed to include the entire document. Sticky navigation is a CSS behavior; if it repeats or covers content in the result, temporarily neutralize its positioning for the capture, then restore it and inspect the image.

Choose the full-page method for your browser

The standard WebDriver screenshot is a viewport or current-browsing-context capture, not a portable full-document screenshot method. Selenium’s Python Firefox API documents full-page methods directly. For Chromium, use its CDP screenshot command and request capture beyond the viewport.

Browser Method Important detail
Firefox get_full_page_screenshot_as_file() or save_full_page_screenshot() Selenium’s Python Firefox API describes these as full-document captures of the current window. Firefox WebDriver API
Chromium CDP Page.captureScreenshot with captureBeyondViewport: true The parameter is optional and defaults to false in the cited Chromium v136 protocol definition. Page.captureScreenshot protocol definition

The CDP protocol is specific to Chromium and related Blink-based browsers. Its tip-of-tree documentation warns that details can change without backward-compatibility guarantees; pin your browser and driver versions and verify captures after upgrades. CDP overview

As an Amazon Associate I earn from qualifying purchases.

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

Handle sticky navigation without damaging the page

Sticky positioning is controlled by CSS, not by a Selenium screenshot setting. A sticky element is positioned relative to a scrolling ancestor and its containing block. It stays stuck after reaching its threshold while it remains within that containing block, and it still occupies space in normal flow. MDN: position

First identify the actual navigation element and its scrolling context. The nearest ancestor with a scrolling mechanism can establish that context; it may be created by overflow: hidden, scroll, auto or overlay. MDN: sticky positioning

If the full-page image repeats the navigation, overlays text, or should show the navigation only once, temporarily change the relevant element’s positioning before capture and restore its original style afterward. This CSS workaround follows from the layout model; Selenium and CDP do not promise identical sticky-element behavior across capture paths. Nested scroll containers, fixed elements and page scripts can affect the result, so inspect the output on the actual page.

Capture a full-page screenshot in Firefox with Selenium Python

The Firefox WebDriver API documents get_full_page_screenshot_as_file(filename) and save_full_page_screenshot(filename), along with methods that return PNG bytes or base64. This runnable example loads a page, neutralizes a selected sticky element for the capture, and restores its inline style even if capture fails. Install Selenium with python -m pip install selenium and ensure Firefox and a compatible WebDriver setup are available.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
from selenium import webdriver
from selenium.webdriver.firefox.options import Options

url = "https://example.com"
sticky_selector = "header.site-header"  # Change to the page's actual selector

options = Options()
# options.add_argument("-headless")  # Uncomment to run without a visible window

driver = webdriver.Firefox(options=options)
try:
    driver.get(url)
    # Replace this with a meaningful readiness condition for your page.
    driver.implicitly_wait(5)

    original_style = driver.execute_script("""
        const el = document.querySelector(arguments[0]);
        if (!el) return null;
        const old = el.getAttribute('style');
        el.style.setProperty('position', 'static', 'important');
        el.style.setProperty('top', 'auto', 'important');
        return old;
    """, sticky_selector)

    try:
        saved = driver.get_full_page_screenshot_as_file("full-page.png")
        if not saved:
            raise RuntimeError("Firefox did not save the full-page screenshot")
        print("Saved full-page.png")
    finally:
        if original_style is not None:
            driver.execute_script("""
                const el = document.querySelector(arguments[0]);
                if (!el) return;
                const old = arguments[1];
                if (old === null) el.removeAttribute('style');
                else el.setAttribute('style', old);
            """, sticky_selector, original_style)
finally:
    driver.quit()

The example’s selector is only illustrative: use the element that actually has sticky positioning, and avoid overriding it if the desired output should preserve its appearance. For dynamic pages, replace the implicit wait with an explicit wait for the content that matters; load or scroll through lazy content as necessary before capture. These readiness steps are operational precautions, not guarantees supplied by the screenshot API.

Capture beyond the viewport in Chromium with CDP

Selenium’s Chromium CDP command interface can invoke Page.captureScreenshot. The example below enables beyond-viewport capture and writes the returned PNG data to disk. It is browser-specific and should be checked against the Chrome and ChromeDriver versions used by your project.

import base64
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

url = "https://example.com"
options = Options()
# options.add_argument("--headless=new")  # Uncomment for headless capture

driver = webdriver.Chrome(options=options)
try:
    driver.get(url)
    # Wait for the page-specific content and lazy-loaded assets you need.
    result = driver.execute_cdp_cmd("Page.captureScreenshot", {
        "format": "png",
        "captureBeyondViewport": True
    })
    with open("full-page.png", "wb") as image_file:
        image_file.write(base64.b64decode(result["data"]))
    print("Saved full-page.png")
finally:
    driver.quit()

The CDP method also supports an optional region clip. This example requests the page capture beyond the viewport; it does not itself change sticky CSS or guarantee a particular treatment of navigation. Apply the same inspect-and-adjust approach if the result repeats or obscures the header.

Prepare the page and verify the result

  1. Wait for meaningful content. Navigate, then wait for a page-specific element or condition rather than assuming that a completed navigation means all application content is ready.
  2. Load what belongs in the image. Lazy images and content may not exist until scrolled into view. Scroll the relevant page or container and wait for those resources before capturing.
  3. Find the sticky element and scroll ancestor. Inspect the CSS and ancestor overflow properties; the nearest ancestor with a scrolling mechanism may control stickiness.
  4. Choose the intended header treatment. Keep the styling if the captured presentation is correct. Otherwise, temporarily neutralize the sticky position and restore the original style in a finally path.
  5. Inspect dimensions and content. Check the top, bottom, navigation, lazy images and any nested scrolling regions. Keep a normal viewport screenshot for comparison and debugging.

Firefox Developer Tools also offers a manual full-page screenshot command for diagnosis: its console helper accepts --fullpage to include content outside the window bounds. This is a browser-tooling option, not a Selenium API. Firefox Developer Tools screenshot helper

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB | 1920×1080 LED Monitor, 4ms GtG, Adaptive Sync, HDMI 1.4, Tilt Adjust, Low Blue Light, 4yr Advance Replacement Warranty
  • 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

Troubleshoot common capture problems

  • The screenshot stops at the viewport: A standard WebDriver screenshot captures the current browsing context. Use Firefox’s full-page API or, in Chromium, request captureBeyondViewport: true.
  • The header appears over content or more than once: Sticky rendering depends on layout and capture behavior. Confirm the correct sticky element and scroll ancestor, test a temporary positioning override, and inspect the result rather than assuming every browser captures it the same way.
  • Images or sections are missing: The page may still be loading or may defer content until it enters a viewport. Wait for page-specific readiness, scroll the relevant container to trigger lazy loading, and wait for assets before capturing.
  • The sticky override has no effect: The selector may target the wrong node, a script may reset styles, or a different ancestor may control scrolling. Inspect computed styles and ancestor overflow, then adjust the target or timing.
  • The CDP call fails after an upgrade: CDP behavior is Chromium-specific and protocol details can change. Check the installed Chrome and driver versions, confirm the command and parameter support for that setup, and validate after version changes.
  • The saved image is blank or incomplete: Check the URL, navigation errors, readiness condition and whether the site requires interaction or authentication. Compare with a regular viewport capture to separate page-loading issues from full-page capture behavior.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server for developers. A single GET request can return a screenshot or PDF; its cookie-banner, popup and chat-widget cleanup is designed to produce cleaner captures, and failed loads, bot checks, blank pages and cache hits are not billed. The MCP server exposes screenshot tools to AI agents, and the free plan includes 1,000 shots per month without a card.

For a WebP capture of the target page, with your API key in place of YOUR_API_KEY:

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【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.
Rank #4
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor | 100Hz, Game Mode, Advanced Eye Comfort, HDMI and D-sub Ports (LS27D366GANXZA)
  • 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
Rank #3
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • 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.
Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB | 1920×1080 LED Monitor, 4ms GtG, Adaptive Sync, HDMI 1.4, Tilt Adjust, Low Blue Light, 4yr Advance Replacement Warranty
  • 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
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 banners, popups and chat widgets are removed before the shot; bot checks, blank pages and failed loads are never billed; an MCP server lets AI agents take screenshots; and 1,000 screenshots a month are free with no card, with paid plans starting at $5 for 3,000. Sign up for the free plan.

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.

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

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.