October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How to Set a Page Load Timeout for Selenium Screenshots

Configure Selenium’s navigation timeout before opening a page, then wait separately for the content your screenshot needs.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Set Selenium’s page-load timeout before calling get(). In Python, driver.set_page_load_timeout(30) sets a 30-second limit on navigation waiting; then use a separate explicit wait if the screenshot depends on dynamic content that appears after the document loads.

Set the timeout before navigation

The page-load timeout limits how long WebDriver waits for a navigation to finish. Selenium’s Python API accepts seconds, so configure it on the driver before the navigation you want to bound. Selenium documents a default of 300,000 milliseconds (five minutes) for a new session; setting your own value makes the limit explicit. Selenium WebDriver options

Runnable Python example

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait

url = "https://example.com"
driver = webdriver.Chrome()
driver.set_page_load_timeout(30)  # seconds

try:
    driver.get(url)

    # Wait for the content the screenshot actually needs.
    WebDriverWait(driver, 10).until(
        lambda d: d.find_element("css selector", "main.loaded")
    )
    driver.save_screenshot("page.png")
except Exception:
    # Handle or log the failure according to your application.
    raise
finally:
    driver.quit()

Replace main.loaded with a selector that exists only when the relevant page content is ready. The explicit wait has its own 10-second limit; it does not change the 30-second navigation timeout. Selenium’s Python API documents set_page_load_timeout(time_to_wait) and screenshot methods including save_screenshot. Python WebDriver API

What the timeout does—and does not—wait for

With the default normal page-load strategy, navigation ordinarily waits for document.readyState to reach complete. That is a document-readiness signal, not proof that a single-page application has finished rendering, that data has arrived, or that lazy-loaded images are visible. Selenium page-load strategies and options

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

Use an explicit wait for the actual screenshot requirement: an element appearing, a loading indicator disappearing, or another observable state. A page-load timeout is not an implicit element wait, an asynchronous-script timeout, or a guarantee that images have rendered.

Page-load strategy choices

Strategy Navigation waits for When it may fit
normal document.readyState = complete Use when the page should finish loading before the next step.
eager document.readyState = interactive Use when it is acceptable to continue before all subresources finish; add explicit waits for screenshot content.
none Does not block on document readiness Use only when the script will manage readiness itself with suitable waits.

Changing strategy affects when navigation returns; none of these strategies guarantees application-specific content is ready. Selenium documentation

Language-specific timeout syntax

Java

In the current Duration-based Java API style:

import java.time.Duration;

 driver.manage().timeouts().pageLoadTimeout(Duration.ofSeconds(30));
 driver.get("https://example.com");
 driver.getScreenshotAs(org.openqa.selenium.OutputType.FILE);

Remove the leading space before driver when copying. The cited Selenium Java 4.28 API documents pageLoadTimeout(Duration); older numeric-time-and-TimeUnit examples are deprecated there. Confirm the API available in your project’s installed version. Java WebDriver.Timeouts API

JavaScript

Selenium’s JavaScript binding describes the pageLoad timeout value in milliseconds. Setter syntax can vary with the binding version, so use the API documentation matching the package installed in your project rather than copying another language’s method or units. Selenium JavaScript API

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.

Choose timeout and recovery behavior deliberately

  • Set a realistic navigation limit. A short limit can fail on a legitimately slow page; a long one delays failure handling. Choose a value based on your workflow and target pages rather than treating the documented five-minute default as a recommendation.
  • Wait for screenshot-specific readiness separately. Navigation completion and dynamic UI readiness are different conditions.
  • Decide what a timeout means to your job. Fail and report it, retry under a bounded policy, or attempt a partial capture only after verifying that behavior in your browser and driver setup.
  • Record useful diagnostics. Log the URL and failure stage so a navigation timeout can be distinguished from an explicit-wait timeout.

If navigation reaches the configured limit, WebDriver raises a timeout error. Whether a useful partial document remains available for a screenshot depends on browser, driver, and timing; Selenium’s cited documentation does not promise that capturing after a navigation timeout will work.

Troubleshooting Selenium screenshot timeouts

get() raises a timeout

The page did not meet the navigation completion condition before the configured limit. Check that the timeout is set before get(), confirm the unit for your language binding, and decide whether to allow more time or fail the capture. Do not assume a partial screenshot is available.

Navigation succeeds but the screenshot is incomplete

The document may be complete while client-side rendering or a needed resource is still in progress. Add an explicit wait tied to the element or state in the image; increasing the page-load timeout alone may not address it.

The explicit wait times out

Check that the selector matches the target page and that the condition represents the ready state you need. A selector that exists before content is populated may need a stronger condition than element presence.

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

Timeout behaves differently across languages

Check the binding’s units and version-specific API: Python uses seconds in the documented setter, Java uses Duration in the cited modern API, and the JavaScript API describes milliseconds for pageLoad.

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

Or skip the browser setup

If you need screenshots without managing a WebDriver session, ScreenshotNeo is a website screenshot API and MCP server. Its API returns an image or PDF from one GET request. For a WebP capture:

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

See the ScreenshotNeo API documentation for request options. Cookie banners are accepted and removed before capture, along with known consent platforms, newsletter popups, and chat widgets; each cleanup step can be turned off. Bot checks/CAPTCHAs, blank pages, timeouts, and failed loads are not billed, and cache hits cost nothing. An MCP server lets AI agents use screenshot tools, and 1,000 screenshots per month are free with no card; paid plans start at $5 for 3,000.

Sign up free for 1,000 screenshots a month, with no card required.

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

Frequently Asked Questions

What is Selenium’s default page-load timeout?

Selenium documents a default of 300,000 milliseconds (five minutes) for a new WebDriver session.

Does a page-load timeout ensure dynamic content is ready for a screenshot?

No. Add an explicit wait for the element or state the screenshot requires.

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
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

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.