Skip to content

[πŸ› Bug]: unconditionally print console log entry when subscribed to eventΒ #14561

@soonum

Description

@soonum

What happened?

Hello here,
I subscribed to a console log event in BiDi with an empty callback handler. The normal behavior should be not to print anything in the terminal. However it systematically prints a JSON string with all the details normally consumed by ConsoleLogEntry.

I believe it's due to a simple development leftover of print(json).
I think this small print should be removed so that user can choose what is printed on screen.

How can we reproduce the issue?

from selenium.webdriver.firefox.options import Options
from selenium.webdriver.firefox.service import Service

def on_console_log(log_entry):
    pass

driver_service = Service(self.driver_path)
options = Options()
options.log.level = "trace"
options.enable_bidi = True
driver = webdriver.Firefox(service=driver_service, options=self.options)
driver.script.add_console_message_handler(on_console_logs)

# Do anything with a Firefox browser that output something to the console to trigger the behavior

Relevant log output

{'type': 'console', 'method': 'warn', 'source': {'realm': '54dd4a6e-8462-4dba-ba26-d64409fe689f', 'context': '47013acc-74ce-49a9-a477-f6a661b5d9a6'}, 'args': [{'type': 'string', 'value': 'using deprecated parameters for the initialization function; pass a single object instead'}], 'level': 'warn', 'text': 'using deprecated parameters for the initialization function; pass a single object instead', 'timestamp': 1728032001729}
{'type': 'console', 'method': 'warn', 'source': {'realm': '54dd4a6e-8462-4dba-ba26-d64409fe689f', 'context': '47013acc-74ce-49a9-a477-f6a661b5d9a6'}, 'args': [{'type': 'string', 'value': 'using deprecated parameters for the initialization function; pass a single object instead'}], 'level': 'warn', 'text': 'using deprecated parameters for the initialization function; pass a single object instead', 'timestamp': 1728032001786}

Operating System

Ubuntu

Selenium version

Python 4.24.0

What are the browser(s) and version(s) where you see this issue?

Firefox 131

What are the browser driver(s) and version(s) where you see this issue?

GeckoDriver 0.35.0

Are you using Selenium Grid?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-needs-triagingA Selenium member will evaluate this soon!I-defectSomething is not working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions