Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛 Bug]: unconditionally print console log entry when subscribed to event #14561

Closed
soonum opened this issue Oct 4, 2024 · 4 comments · Fixed by #14562
Closed

[🐛 Bug]: unconditionally print console log entry when subscribed to event #14561

soonum opened this issue Oct 4, 2024 · 4 comments · Fixed by #14562

Comments

@soonum
Copy link

soonum commented Oct 4, 2024

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

Copy link

github-actions bot commented Oct 4, 2024

@soonum, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@Delta456
Copy link
Contributor

Delta456 commented Oct 4, 2024

I will fix this, thanks!

@Delta456
Copy link
Contributor

Delta456 commented Oct 4, 2024

Should be done in #14562

Copy link

github-actions bot commented Nov 3, 2024

This issue has been automatically locked since there has not been any recent activity since it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Nov 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants