{"record":{"id":"18cf2c80207c830b","repo":"SeleniumHQ/selenium","slug":"debugger-address-must-be-a-string","errorCode":null,"errorMessage":"Debugger Address must be a string","messagePattern":"Debugger Address must be a string","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"py/selenium/webdriver/chromium/options.py","lineNumber":68,"sourceCode":"        \"\"\"\n        if not isinstance(value, str):\n            raise TypeError(self.BINARY_LOCATION_ERROR)\n        self._binary_location = value\n\n    @property\n    def debugger_address(self) -> str | None:\n        \"\"\"Returns the address of the remote devtools instance.\"\"\"\n        return self._debugger_address\n\n    @debugger_address.setter\n    def debugger_address(self, value: str) -> None:\n        \"\"\"Set the address of the remote devtools instance for active wait connection.\n\n        Args:\n            value: Address of remote devtools instance if any (hostname[:port]).\n        \"\"\"\n        if not isinstance(value, str):\n            raise TypeError(\"Debugger Address must be a string\")\n        self._debugger_address = value\n\n    @property\n    def extensions(self) -> list[str]:\n        \"\"\"Returns a list of encoded extensions that will be loaded.\"\"\"\n\n        def _decode(file_data: BinaryIO) -> str:\n            # Should not use base64.encodestring() which inserts newlines every\n            # 76 characters (per RFC 1521).  Chromedriver has to remove those\n            # unnecessary newlines before decoding, causing performance hit.\n            return base64.b64encode(file_data.read()).decode(\"utf-8\")\n\n        encoded_extensions = []\n        for extension in self._extension_files:\n            with open(extension, \"rb\") as f:\n                encoded_extensions.append(_decode(f))\n\n        return encoded_extensions + self._extensions","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/py/selenium/webdriver/chromium/options.py#L50-L86","documentation":"The `debugger_address` setter on `ChromiumOptions` requires a `str` of the form `hostname[:port]`, used to connect to a running DevTools instance for an 'active wait' connection. Non-string values are rejected. This lets you attach Selenium to an already-running Chrome started with `--remote-debugging-port`.","triggerScenarios":"`options.debugger_address = 9222` (passing an int port alone), `options.debugger_address = (\"localhost\", 9222)` (a tuple), or `options.debugger_address = None`. The address must include the hostname.","commonSituations":"Confusing the address with just a port number. Passing a tuple from a config object. Forgetting to disable it when reusing options across sessions.","solutions":["Pass the full host:port string: `options.debugger_address = \"localhost:9222\"`.","Build it from components: `options.debugger_address = f\"{host}:{port}\"`.","Leave it unset if you are not attaching to an existing DevTools endpoint."],"exampleFix":"// before\noptions.debugger_address = 9222  # TypeError\n// after\noptions.debugger_address = \"localhost:9222\"","handlingStrategy":"validation","validationCode":"host, port = \"localhost\", 9222\naddr = host if \":\" in host else f\"{host}:{port}\"\nassert isinstance(addr, str) and addr, \"debugger_address must be a non-empty host[:port] string\"\noptions.debugger_address = addr","typeGuard":"def is_debugger_address(value) -> bool:\n    return isinstance(value, str) and len(value) > 0","tryCatchPattern":"try:\n    options.debugger_address = addr\nexcept TypeError:\n    options.debugger_address = f\"localhost:{addr}\" if isinstance(addr, int) else str(addr)","preventionTips":["Always include the hostname in the address string.","Build the address from host/port with an f-string.","Validate the address is a str before assignment."],"tags":["options","debugger-address","type-check","devtools"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}