Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:SeleniumHQ Selenium PageLoadStrategy

From Leeroopedia
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 (the DOMContentLoaded event 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 (the load event 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 NONE for speed-critical automation where you do not need the full page to be ready.
  • Use EAGER when 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

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

Enum Constants
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)
Methods
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

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment