SeleniumHQ/selenium · error · ValueError
Strategy can only be one of the following: normal, eager, no
Error message
Strategy can only be one of the following: normal, eager, none
What it means
The page_load_strategy property on an Options object validates that the value is one of the three W3C-defined strategies: 'normal', 'eager', or 'none'. Any other value raises ValueError. This maps to the W3C pageLoadStrategy capability.
Source
Thrown at py/selenium/webdriver/common/options.py:86
See:
- https://w3c.github.io/webdriver/#dfn-table-of-page-load-strategies.
Args:
strategy: the strategy corresponding to a document readiness state
"""
def __init__(self, name):
self.name = name
def __get__(self, obj, cls):
return obj._caps.get(self.name)
def __set__(self, obj, value):
if value in ("normal", "eager", "none"):
obj.set_capability(self.name, value)
else:
raise ValueError("Strategy can only be one of the following: normal, eager, none")
class _UnHandledPromptBehaviorDescriptor:
"""How the driver should respond when an alert is present and the command sent is not handling the alert.
See:
- https://w3c.github.io/webdriver/#dfn-table-of-page-load-strategies:
Args:
behavior: behavior to use when an alert is encountered
Returns:
Values for implicit timeout, pageLoad timeout and script timeout if set (in milliseconds)
"""
def __init__(self, name):
self.name = name
View on GitHub (pinned to aa36b38e69)
Solutions
- Use one of the literal lowercase strings: 'normal', 'eager', or 'none'.
- Use the PageLoadStrategy enum: options.page_load_strategy = PageLoadStrategy.eager.value.
- Double-check casing — values must be lowercase.
Example fix
# before options.page_load_strategy = 'networkidle' # raises ValueError # after options.page_load_strategy = 'none' # or via enum from selenium.webdriver.common.options import PageLoadStrategy options.page_load_strategy = PageLoadStrategy.eager.value
Defensive patterns
Strategy: validation
Validate before calling
from selenium.webdriver.common.options import PageLoadStrategy
valid = {s.value for s in PageLoadStrategy}
if strategy not in valid:
raise ValueError(f'Invalid page_load_strategy {strategy!r}; choose from {sorted(valid)}')
options.page_load_strategy = strategy Type guard
from selenium.webdriver.common.options import PageLoadStrategy
def is_valid_page_load_strategy(v: str) -> bool:
return v in {s.value for s in PageLoadStrategy} Try / catch
try:
options.page_load_strategy = strategy
except ValueError:
options.page_load_strategy = 'normal' # safe default Prevention
- Source the value from the PageLoadStrategy enum rather than a literal.
- Lowercase and validate external input before assigning.
When it happens
Trigger: Setting options.page_load_strategy = 'fast', options.page_load_strategy = 'complete', or any string outside the allowed set. Case typos like 'Normal' or 'EAGER' also trigger it (comparison is case-sensitive, lowercase only).
Common situations: Confusing Selenium page-load strategies with browser/Playwright concepts ('domcontentloaded', 'load', 'networkidle'). Passing an enum or capitalized value. Copying config from a non-Selenium framework.
Related errors
- Behavior can only be one of the following: dismiss, accept,
- Timeout keys can only be one of the following: implicit, pag
- no capabilities provided for merge
- Capability keys must be strings: ${typeof key}
- argument can not be null
AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14).
Data as JSON: /api/errors/dc91ac9abbbfae6f.
Report an issue: GitHub.