{"record":{"id":"b52000f7df938c9a","repo":"D4Vinci/Scrapling","slug":"cdp-url-must-use-ws-wss-http-or","errorCode":null,"errorMessage":"CDP URL must use 'ws://', 'wss://', 'http://', or 'https://' scheme","messagePattern":"CDP URL must use 'ws://', 'wss://', 'http://', or 'https://' scheme","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"scrapling/engines/_browsers/_validators.py","lineNumber":112,"sourceCode":"    dns_over_https: bool = False\n\n    def __post_init__(self):  # pragma: no cover\n        \"\"\"Custom validation after msgspec validation\"\"\"\n        if self.page_action and not callable(self.page_action):\n            raise TypeError(f\"page_action must be callable, got {type(self.page_action).__name__}\")\n        if self.page_setup and not callable(self.page_setup):\n            raise TypeError(f\"page_setup must be callable, got {type(self.page_setup).__name__}\")\n        if self.proxy and self.proxy_rotator:\n            raise ValueError(\n                \"Cannot use 'proxy_rotator' together with 'proxy'. \"\n                \"Use either a static proxy or proxy rotation, not both.\"\n            )\n        if self.proxy:\n            self.proxy = construct_proxy_dict(self.proxy)\n        if self.cdp_url:\n            cdp_msg = _is_invalid_cdp_url(self.cdp_url)\n            if cdp_msg:\n                raise ValueError(cdp_msg)\n\n        if not self.cookies:\n            self.cookies = []\n        if not self.extra_flags:\n            self.extra_flags = []\n        if not self.selector_config:\n            self.selector_config = {}\n        if not self.additional_args:\n            self.additional_args = {}\n        if not self.capture_xhr:\n            self.capture_xhr = None\n\n        if self.init_script is not None:\n            validation_msg = _is_invalid_file_path(self.init_script)\n            if validation_msg:\n                raise ValueError(validation_msg)\n\n        if self.executable_path is not None:","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/D4Vinci/Scrapling/blob/5d213a2d4764002bfc4fed33c32fe09fa8b0bf7f/scrapling/engines/_browsers/_validators.py#L94-L130","documentation":"Raised when the `cdp_url` config value does not start with ws://, wss://, http://, or https://. Scrapling validates this up front because Playwright's connect_over_cdp requires a proper endpoint URL, and the check catches inputs like 'localhost:9222' or 'chromium:9222' before a confusing Playwright failure.","triggerScenarios":"Passing cdp_url='localhost:9222' (no scheme), cdp_url='9222', or a pathlike endpoint without protocol. Note the ws endpoint usually looks like ws://host:port/devtools/browser/<id>.","commonSituations":"Copy-pasting the host:port from Chrome's --remote-debugging-port output without prefixing http://, or using the DevTools page URL instead of the WebSocket endpoint.","solutions":["Prefix the endpoint with a supported scheme, e.g. cdp_url='http://localhost:9222'","For WebSocket endpoints use the full ws://host:port/devtools/browser/<uuid> URL from http://host:port/json/version","Do not pass a bare host:port"],"exampleFix":"// before\nsession = StealthySession(cdp_url='localhost:9222')\n\n// after\nsession = StealthySession(cdp_url='http://localhost:9222')","handlingStrategy":"validation","validationCode":"ALLOWED = ('ws://', 'wss://', 'http://', 'https://')\nassert cdp_url.startswith(ALLOWED), f'cdp_url must start with one of {ALLOWED}'","typeGuard":"def is_valid_cdp_url(u: str) -> bool:\n    return isinstance(u, str) and u.startswith(('ws://', 'wss://', 'http://', 'https://'))","tryCatchPattern":"try:\n    session = StealthySession(cdp_url=ep)\nexcept ValueError as e:\n    if 'CDP URL' in str(e):\n        ep = 'http://' + ep  # normalize host:port input\n        session = StealthySession(cdp_url=ep)\n    else:\n        raise","preventionTips":["Normalize user-supplied host:port to http://host:port before passing","Fetch the real ws endpoint from http://host:port/json/version when connecting to Chrome","Never pass a bare host:port as cdp_url"],"tags":["validation","cdp","url","config"],"backgroundTag":null,"analyzedSha":"5d213a2d4764002bfc4fed33c32fe09fa8b0bf7f","analyzedAt":"2026-08-14T22:23:09.440Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}