{"record":{"id":"d8659756a999cd63","repo":"SeleniumHQ/selenium","slug":"please-pass-in-a-boolean-to-this-call","errorCode":null,"errorMessage":"Please pass in a Boolean to this call","messagePattern":"Please pass in a Boolean to this call","errorType":"exception","errorClass":"WebDriverException","httpStatus":null,"severity":"error","filePath":"py/selenium/webdriver/firefox/firefox_profile.py","lineNumber":132,"sourceCode":"        try:\n            port = int(port)\n            if port < 1 or port > 65535:\n                raise WebDriverException(\"Port number must be in the range 1..65535\")\n        except (ValueError, TypeError):\n            raise WebDriverException(\"Port needs to be an integer\")\n        self._port = port\n        self.set_preference(\"webdriver_firefox_port\", self._port)\n\n    @property\n    @deprecated(\"Allowing untrusted certs is toggled in the Options class\")\n    def accept_untrusted_certs(self):\n        return self._desired_preferences[\"webdriver_accept_untrusted_certs\"]\n\n    @accept_untrusted_certs.setter\n    @deprecated(\"Allowing untrusted certs is toggled in the Options class\")\n    def accept_untrusted_certs(self, value) -> None:\n        if not isinstance(value, bool):\n            raise WebDriverException(\"Please pass in a Boolean to this call\")\n        self.set_preference(\"webdriver_accept_untrusted_certs\", value)\n\n    @property\n    @deprecated(\"Allowing untrusted certs is toggled in the Options class\")\n    def assume_untrusted_cert_issuer(self):\n        return self._desired_preferences[\"webdriver_assume_untrusted_issuer\"]\n\n    @assume_untrusted_cert_issuer.setter\n    @deprecated(\"Allowing untrusted certs is toggled in the Options class\")\n    def assume_untrusted_cert_issuer(self, value) -> None:\n        if not isinstance(value, bool):\n            raise WebDriverException(\"Please pass in a Boolean to this call\")\n\n        self.set_preference(\"webdriver_assume_untrusted_issuer\", value)\n\n    @property\n    def encoded(self) -> str:\n        \"\"\"Update preferences and create a zipped, base64-encoded profile directory string.\"\"\"","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/py/selenium/webdriver/firefox/firefox_profile.py#L114-L150","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nprofile.accept_untrusted_certs = 'true'\n\n// after\nprofile.accept_untrusted_certs = True","handlingStrategy":"type-guard","validationCode":"value = 'true'\nif not isinstance(value, bool):\n    value = str(value).lower() in ('true', '1')\nprofile.accept_untrusted_certs = value","typeGuard":"def is_bool(v) -> bool:\n    return isinstance(v, bool)","tryCatchPattern":"from selenium.common.exceptions import WebDriverException\ntry:\n    profile.accept_untrusted_certs = config_value\nexcept WebDriverException:\n    profile.accept_untrusted_certs = bool(config_value)","preventionTips":["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"],"tags":["firefox","type-validation","deprecated","profile","boolean"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}