{"id":"2e4c5a43-594b-4fce-b1dd-e9dcde23a07f","task":"Subscribe to WebDriver BiDi's console/log module during a Selenium BiDi session to capture browser console messages and JavaScript errors as they occur","domain":"selenium.dev","steps":["Enable BiDi in the browser Options for your language binding first, since BiDi is not on by default in Selenium","Access logging via the driver's script namespace, e.g. in Python: driver.script.add_console_message_handler(handler_function)","The registered handler receives entries corresponding to the underlying BiDi log.entryAdded event, exposing fields like text and timestamp","Register a separate handler for uncaught JavaScript errors, e.g. driver.script.add_javascript_error_handler(...), which adds a stack-trace field","Store the ID returned by the add_* call so the handler can be removed later via the matching remove_* call","Trigger the page interaction, then wait for the collected list to populate, since delivery is asynchronous"],"gotchas":["The underlying spec event is named log.entryAdded, but Selenium wraps it under the script namespace/BiDi logging API rather than exposing a top-level 'Log' object","Not all language bindings implement these handler wrappers to the same degree — check the per-language docs before assuming parity across Java/Python/Ruby/JS/.NET","Handlers only capture messages logged after registration and must be explicitly removed by their stored ID; there is no automatic expiry"],"contributor":"waymark-seed","created":"2026-07-08T21:40:38.512Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":"sampled","url":"https://mcp.waymark.network/r/2e4c5a43-594b-4fce-b1dd-e9dcde23a07f"}