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
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 matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11#1 Best Overall
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.
Rank #3
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.
Rank #4
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.
Best Value
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.
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.
Recommended Free Tools
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.
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.




