Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk6 min

How to Capture a Lazy-Loading Page with Selenium and Python

A practical Selenium Python pattern for triggering lazy-loaded content, waiting for the right signal, and saving either a viewport screenshot or a supported full-page capture.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

To capture content that loads as you scroll, use Selenium to scroll through the page, wait for a page-specific signal that new content has appeared, and then save a screenshot. Scrolling can trigger lazy loading, but driver.get() finishing does not prove that later JavaScript content is ready. Also, Selenium’s standard screenshot method captures the current browser window—not automatically the entire document.

Install Selenium and prepare a browser

Install Selenium in the Python environment that will run the script:

python -m pip install selenium

Use a browser supported by your installed Selenium setup. Selenium Manager can manage drivers for supported browsers in many standard setups, but browser and driver availability can vary by environment. The example below uses Chrome; adjust the driver construction if you use another browser.

Scroll, wait for content, and save a viewport screenshot

This bounded-page template scrolls by part of the viewport, waits for the document height to grow or for the bottom to come into view, and saves the final viewport as a PNG. Replace the example URL and, where possible, replace the generic height condition with a signal that reflects the content you need, such as a known card becoming visible or a result count increasing. This is a generic template, not a guarantee for every site.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Logitech Brio 101 Full HD 1080p Webcam for Streaming and Meetings - Black
  • Compatible with Nintendo Switch 2’s new GameChat mode
  • Auto-Light Balance: RightLight boosts brightness by up to 50%, reducing shadows so you look your best—compared to previous-generation Logitech webcams (1)
  • Privacy with a Slide: The integrated webcam cover makes it easy to get total, reliable privacy when you're not on a video call
  • Built-In Mic: The built-in microphone lets others hear you clearly during video calls
  • Easy Plug-And-Play: The Brio 101 works with most video calling platforms, including Microsoft Teams, Zoom and Google Meet—no hassle; it just works
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait

url = "https://example.com/page"
output_path = "page.png"

options = Options()
# Uncomment for a headless run:
# options.add_argument("--headless=new")

 driver = webdriver.Chrome(options=options)
try:
    driver.set_window_size(1440, 1000)
    driver.get(url)

    wait = WebDriverWait(driver, 10)
    previous_height = driver.execute_script(
        "return document.body.scrollHeight"
    )

    while True:
        driver.execute_script(
            "window.scrollBy(0, Math.floor(window.innerHeight * 0.8))"
        )
        wait.until(
            lambda d: d.execute_script(
                "return document.body.scrollHeight"
            ) > previous_height
            or d.execute_script(
                "return window.scrollY + window.innerHeight >= "
                "document.body.scrollHeight"
            )
        )

        current_height = driver.execute_script(
            "return document.body.scrollHeight"
        )
        if current_height == previous_height:
            break
        previous_height = current_height

    if not driver.save_screenshot(output_path):
        raise IOError(f"Could not save screenshot to {output_path}")
finally:
    driver.quit()

There is one indentation correction to make before running the listing: the line that creates the driver should start at the left margin, as shown here:

driver = webdriver.Chrome(options=options)

The code uses an explicit wait rather than assuming navigation completion means every lazy image or asynchronously added card is ready. Selenium’s Python API documents execute_script() as synchronous JavaScript execution in the current window or frame and documents save_screenshot() as saving the current window to PNG. The API also returns a boolean from the screenshot call, which the example checks. See the Selenium Python WebDriver API, the Selenium waits guide, and the Selenium browser options guide.

Rank #2
Sale
Logitech C270 720p Webcam Plug-and-Play Wide Screen Video Calling - Black
  • Compatible with Nintendo Switch 2’s new GameChat mode
  • Crisp HD 720p/30 fps video calls with diagonal 55° field of view and auto light correction. Compatible with popular platforms including Skype and Zoom.
  • The built-in noise-reducing mic makes sure your voice comes across clearly up to 1.5 meters away, even if you’re in busy surroundings.
  • C270’s RightLight 2 feature adjusts to lighting conditions, producing brighter, contrasted images to help you look good in all your conference calls.
  • The adjustable universal clip lets you attach the camera securely to your screen or laptop, or fold the clip and set the webcam on a shelf. You’re always ready for your next video call.

Make the stopping condition fit the page

The height-based loop is useful only when document height is a reasonable proxy for new content. It can stop too early if content arrives after the height stays unchanged briefly, or fail to describe a page that loads data in batches without changing height. Prefer a site-specific explicit wait when you can identify what success means:

  • Wait for a known lazy-loaded image or card to become visible.
  • Wait for a result count to increase after a scroll.
  • Wait for a known end marker to appear.
  • For a feed that can continue indefinitely, set a maximum number of scrolls or stop after the target item appears.

Lazy loading commonly responds to interactions such as scrolling and navigation, but the precise trigger and distance vary by page and browser. MDN describes these common triggers in its lazy-loading guide.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
NexiGo N60 1080P Webcam with Microphone, Software Control & Privacy Cover, USB HD Computer Web Camera, Plug and Play, for Zoom/Skype/Teams, Conferencing and Video Calling
  • 【Full HD 1080P Webcam】Powered by a 1080p FHD two-MP CMOS, the NexiGo N60 Webcam produces exceptionally sharp and clear videos at resolutions up to 1920 x 1080 with 30fps. The 3.6mm glass lens provides a crisp image at fixed distances and is optimized between 19.6 inches to 13 feet, making it ideal for almost any indoor use.
  • 【Wide Compatibility】Works with USB 2.0/3.0, no additional drivers required. Ready to use in approximately one minute or less on any compatible device. Compatible with Mac OS X 10.7 and higher / Windows 7, 8, 10 & 11 / Android 4.0 or higher / Linux 2.6.24 / Chrome OS 29.0.1547 / Ubuntu Version 10.04 or above. Not compatible with XBOX/PS4/PS5.
  • 【Built-in Noise-Cancelling Microphone】The built-in noise-canceling microphone reduces ambient noise to enhance the sound quality of your video. Great for Zoom / Facetime / Video Calling / OBS / Twitch / Facebook / YouTube / Conferencing / Gaming / Streaming / Recording / Online School.
  • 【USB Webcam with Privacy Protection Cover】The privacy cover blocks the lens when the webcam is not in use. It's perfect to help provide security and peace of mind to anyone, from individuals to large companies. 【Note:】Please contact our support for firmware update if you have noticed any audio delays.
  • 【Wide Compatibility】Works with USB 2.0/3.0, no additional drivers required. Ready to use in approximately one minute or less on any compatible device. Compatible with Mac OS X 10.7 and higher / Windows 7, 10 & 11, Pro / Android 4.0 or higher / Linux 2.6.24 / Chrome OS 29.0.1547 / Ubuntu Version 10.04 or above. Not compatible with XBOX/PS4/PS5.

Use a nested scroll container when needed

Some sites scroll a panel rather than the document. In that case, find the panel and scroll it instead of calling window.scrollBy(). For example:

panel = driver.find_element("css selector", ".scrollable-panel")
driver.execute_script(
    "arguments[0].scrollTop = arguments[0].scrollTop + arguments[0].clientHeight * 0.8",
    panel,
)

Change the selector to match the page, and wait for a relevant panel-specific condition after each move. A custom scroller may have its own height, end marker, or loading behavior.

Rank #4
Sale
EMEET C960 1080P Webcam with Microphone, 2 Mics, 90° FOV, Computer Camera
  • 1080P Webcam with Cover for Video Calls - EMEET computer webcam provides design and Optimization for professional video streaming. Realistic 1920 x 1080p video, 5-layer anti-glare lens, providing smooth video. C960 computer camera delivers 1920x1080 video with fixed focus (11.8–118.1 inches), so as to provide a clearer image. C960 USB webcam has a cover and can be removed automatically to meet your needs for privacy. For optimal image performance, use the webcam in a well-lit environment.
  • Built-in 2 Omnidirectional Mics - EMEET webcam with microphone for desktop features 2 built-in omnidirectional microphones, picking up your voice to create clear audio for communication. When installing the webcam, select EMEET C960 as the default microphone input device in your computer and video applications and select C960 as the default device in Zoom/Teams and ensure microphone permissions are enabled for proper use. Please note that C960 does not include built-in speakers.
  • Automatic Light Adjustment - Automatic exposure adjustment is applied in EMEET HD webcam 1080p so that the streaming webcam can deliver stable image performance. EMEET C960 camera for computer also features color adjustment and exposure optimization to help you look your best. For optimal video quality, it is recommended to use the webcam in normal or well-lit environments and select suitable video settings in your application. Proper lighting helps achieve a clearer and more balanced image.
  • Plug-and-Play & Upgraded USB Connectivity - New C960 webcam features both USB Type-A & A-to-C adapter connections for wider compatibility. For stable performance, connect the webcam directly to the computer's main USB port and ensure the device is recognized correctly. If a hub or docking station is used, please ensure it provides sufficient power and stable data transmission, as limited ports may affect performance. 90° wide-angle lens captures more participants without frequent adjustments.
  • High Compatibility & Multi Application - C960 webcam for laptop is compatible with Windows 10/11, macOS 10.14+, and Android TV 7.0+. Not supported: Windows Hello, TVs, tablets, or game consoles. It works with Zoom, Teams, Facetime, Google Meet, YouTube and more. Please select C960 webcam as the default camera and microphone device in your application and ensure camera/microphone permissions are enabled, especially on macOS. (Tips: Incompatible with Windows Hello)

Fixed pauses versus explicit waits

A fixed pause is simple, but it does not establish that the intended content loaded: it can waste time on fast responses and still be too short on slow ones. Prefer WebDriverWait with a meaningful condition, such as visibility of an element or a changed result count. Use a short fixed delay only as a fallback when the page offers no observable signal, and treat it as a best-effort pause rather than proof of readiness. Selenium’s waits guide shows explicit waits for conditions including element visibility.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Viewport image or full-page image?

Scrolling triggers content and determines which part of the page is visible when you capture. It does not make the standard save_screenshot() call produce one tall image of the whole document.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Goal Method Important distinction
Capture what is currently visible driver.save_screenshot("page.png") Saves the current window; scroll to the desired position first.
Capture the full document Firefox Python API methods get_full_page_screenshot_as_file() or save_full_page_screenshot() These are documented for Firefox’s driver API; check compatibility with the browser and driver version you use.

See the general Selenium Python WebDriver API and the Firefox WebDriver API for the documented screenshot methods.

Common problems and fixes

  • Images or cards are missing: Navigation may have completed while deferred content is still pending. Scroll the relevant area into view, then wait for the image, card, or data signal you need.
  • The script stops before the end: A brief unchanged height does not prove that a feed is finished. Wait for a known marker or result change, or use a bounded retry strategy appropriate to the page.
  • The script never finishes: The page may continuously append content or change its height. Add a maximum scroll count, a target cutoff, or a meaningful end condition.
  • Scrolling does not trigger loading: Check whether the page uses a nested scroll container, requires a different interaction, or blocks automated browsing. Scroll the correct element and verify the page state.
  • The screenshot is only one screen tall: That is expected from the standard current-window screenshot method. Use a documented full-page method supported by your browser/driver, or capture multiple viewport images if appropriate.
  • No PNG appears: Check the output directory and permissions, and treat a false return from save_screenshot() as a failure rather than success. Selenium also documents get_screenshot_as_file() as returning false on an I/O error.
  • The browser remains running after an error: Keep browser work inside try/finally and call driver.quit() in the cleanup block.

Or skip the browser setup

ScreenshotNeo provides a screenshot API and MCP server for developers. Its capture flow accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before taking a shot; each of those steps can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and responses include X-Page-Verdict and X-Billed headers. AI agents can use its MCP tools, including take_screenshot, get_page_info, and capture_pdf. For cases where its capture behavior fits your needs, a single GET request returns an image or PDF. See the ScreenshotNeo website and API documentation.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com/page -o shot.webp

The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Sign up for ScreenshotNeo and start with 1,000 free screenshots a month, no card required.

Frequently Asked Questions

Does scrolling before a screenshot make Selenium capture the full page?

No. Scrolling can trigger content loading, but the standard screenshot method still saves the current browser window. Use a compatible full-page screenshot method if you need one document-height image.

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

Why can lazy-loaded content be missing after driver.get() returns?

Navigation completion does not guarantee that later JavaScript-driven content has appeared. Scroll to trigger it and wait for a signal specific to the content you need.

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.

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
Windows Errors? Fix Them Before They SpreadFree repair scan
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.