SeleniumHQ/selenium · error · WebDriverException
Please pass in a Boolean to this call
Error message
Please pass in a Boolean to this call
What it means
Raised by the deprecated FirefoxProfile.accept_untrusted_certs setter when the assigned value is not a Python bool. The property is deprecated and the untrusted-cert behavior has moved to the Firefox Options class. The library enforces strict bool typing so that the preference is never silently coerced into a non-boolean value that Firefox would misinterpret.
Source
Thrown at py/selenium/webdriver/firefox/firefox_profile.py:132
try:
port = int(port)
if port < 1 or port > 65535:
raise WebDriverException("Port number must be in the range 1..65535")
except (ValueError, TypeError):
raise WebDriverException("Port needs to be an integer")
self._port = port
self.set_preference("webdriver_firefox_port", self._port)
@property
@deprecated("Allowing untrusted certs is toggled in the Options class")
def accept_untrusted_certs(self):
return self._desired_preferences["webdriver_accept_untrusted_certs"]
@accept_untrusted_certs.setter
@deprecated("Allowing untrusted certs is toggled in the Options class")
def accept_untrusted_certs(self, value) -> None:
if not isinstance(value, bool):
raise WebDriverException("Please pass in a Boolean to this call")
self.set_preference("webdriver_accept_untrusted_certs", value)
@property
@deprecated("Allowing untrusted certs is toggled in the Options class")
def assume_untrusted_cert_issuer(self):
return self._desired_preferences["webdriver_assume_untrusted_issuer"]
@assume_untrusted_cert_issuer.setter
@deprecated("Allowing untrusted certs is toggled in the Options class")
def assume_untrusted_cert_issuer(self, value) -> None:
if not isinstance(value, bool):
raise WebDriverException("Please pass in a Boolean to this call")
self.set_preference("webdriver_assume_untrusted_issuer", value)
@property
def encoded(self) -> str:
"""Update preferences and create a zipped, base64-encoded profile directory string."""View on GitHub (pinned to aa36b38e69)
Solutions
- Pass a literal Python bool: profile.accept_untrusted_certs = True
- If your value comes from config/env, convert explicitly with bool() or parse 'true'/'false' strings before assignment
- Stop using the deprecated property and set the option on the Options class instead
Example fix
// before profile.accept_untrusted_certs = 'true' // after profile.accept_untrusted_certs = True
Defensive patterns
Strategy: type-guard
Validate before calling
value = 'true'
if not isinstance(value, bool):
value = str(value).lower() in ('true', '1')
profile.accept_untrusted_certs = value Type guard
def is_bool(v) -> bool:
return isinstance(v, bool) Try / catch
from selenium.common.exceptions import WebDriverException
try:
profile.accept_untrusted_certs = config_value
except WebDriverException:
profile.accept_untrusted_certs = bool(config_value) Prevention
- Always pass native Python True/False literals
- Convert config/env values to bool before assignment
- Migrate to the Options class API which is not deprecated
When it happens
Trigger: Assigning profile.accept_untrusted_certs = 1, profile.accept_untrusted_certs = 'true', or profile.accept_untrusted_certs = None triggers the WebDriverException. Only Python True/False are accepted.
Common situations: Developers migrating from older Selenium versions where string 'true'/'false' or integer 0/1 were tolerated. Users copy-pasting YAML or JSON config values that arrive as strings rather than native booleans.
Related errors
- Port needs to be an integer
- Port number must be in the range 1..65535
- Autodetect proxy value needs to be a boolean
- Add-on path does not exist: {addon_path}
- Add-on path is neither an XPI nor a directory: {addon_path}
AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14).
Data as JSON: /api/errors/d8659756a999cd63.
Report an issue: GitHub.