Implementation:SeleniumHQ Selenium PageLoadStrategy
| Knowledge Sources | |
|---|---|
| Domains | WebDriver, Browser_Automation |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
Concrete tool for specifying when a browser navigation command should be considered complete, provided by the Selenium WebDriver library.
Description
PageLoadStrategy is a Java enum in the org.openqa.selenium package that defines three strategies the WebDriver can use to determine when a page load has finished. The strategies correspond directly to the W3C WebDriver specification's "page load strategy" capability:
- NONE (
"none") -- The WebDriver does not wait for the page to load at all. Control returns immediately after initiating navigation. - EAGER (
"eager") -- The WebDriver waits until the DOM is interactive (theDOMContentLoadedevent fires), but does not wait for stylesheets, images, or subframes to finish loading. - NORMAL (
"normal") -- The WebDriver waits until the full page load is complete (theloadevent fires). This is the default behavior.
Each enum constant wraps a lowercase string value that corresponds to the W3C wire protocol value. The enum provides a fromString static factory method for case-insensitive lookup and overrides toString() to return the wire-protocol string.
Usage
Use PageLoadStrategy when configuring browser capabilities via AbstractDriverOptions or directly in a Capabilities map. Set it before creating a WebDriver session to control how navigation commands (get(), navigate().to()) behave:
- Use
NONEfor speed-critical automation where you do not need the full page to be ready. - Use
EAGERwhen you only need the DOM structure and want to avoid waiting for external resources. - Use
NORMAL(the default) when you need the page to be fully loaded before interacting with it.
Code Reference
Source Location
- Repository: SeleniumHQ_Selenium
- File: java/src/org/openqa/selenium/PageLoadStrategy.java
Signature
public enum PageLoadStrategy {
NONE("none"),
EAGER("eager"),
NORMAL("normal");
PageLoadStrategy(String text)
public String toString()
public static PageLoadStrategy fromString(String text)
}
Import
import org.openqa.selenium.PageLoadStrategy;
I/O Contract
| Constant | Wire Value | Description |
|---|---|---|
NONE |
"none" |
Do not wait for the page to load |
EAGER |
"eager" |
Wait until DOM is interactive (DOMContentLoaded) |
NORMAL |
"normal" |
Wait until full page load completes (load event) |
| Method | Input | Output | Description |
|---|---|---|---|
toString() |
none | String -- wire-protocol value |
Returns the lowercase string representation of the strategy |
fromString(String text) |
String (nullable, case-insensitive) |
PageLoadStrategy or null |
Looks up the enum constant matching the given string; returns null if no match or input is null |
Usage Examples
// Set page load strategy to EAGER for faster navigation
ChromeOptions options = new ChromeOptions();
options.setPageLoadStrategy(PageLoadStrategy.EAGER);
WebDriver driver = new ChromeDriver(options);
// Set page load strategy to NONE for maximum speed
FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.setPageLoadStrategy(PageLoadStrategy.NONE);
WebDriver firefoxDriver = new FirefoxDriver(firefoxOptions);
// Convert from a string value (e.g., from configuration)
PageLoadStrategy strategy = PageLoadStrategy.fromString("normal");
// Get the wire-protocol string for serialization
String wireValue = PageLoadStrategy.EAGER.toString(); // returns "eager"
Related Pages
- Implementation:SeleniumHQ_Selenium_UnexpectedAlertBehaviour -- another W3C capability enum
- Implementation:SeleniumHQ_Selenium_WebDriverException -- base exception for WebDriver errors
- Concept:W3C_WebDriver_Capabilities -- the capabilities model where PageLoadStrategy is used