Skip to content

[🐛 Bug]: [dotnet] Selenium Library should never write to my console #15785

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

Open
nvborisenko opened this issue May 23, 2025 · 10 comments
Open
Labels
A-needs-triaging A Selenium member will evaluate this soon! I-defect Something is not working as intended I-regression Something was working but we "fixed" it

Comments

@nvborisenko
Copy link
Member

nvborisenko commented May 23, 2025

Description

I have my own application, let's say console application. I use many libraries to achieve my goal. No one is writing to console, except I explicitly allow to do it.

https://www.selenium.dev/documentation/webdriver/troubleshooting/logging/

The default logging level is Info.

Reproducible Code

Selenium is a library! It performs low level operations. If this library wants to output something (for instance internal log messages), I should control it. But library should never output by default!
@nvborisenko nvborisenko added I-defect Something is not working as intended A-needs-triaging A Selenium member will evaluate this soon! labels May 23, 2025
@selenium-ci
Copy link
Member

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

Selenium Triage Team: remember to follow the Triage Guide

@github-actions github-actions bot added the I-regression Something was working but we "fixed" it label May 23, 2025
Copy link

⚠️ You reported using Selenium version 4.32, but the latest release is 4.33.

Please verify that this issue still occurs with the latest version. If it no longer applies, you can close this issue or update your comment.

This issue will be marked "awaiting answer" and may be closed automatically if no response is received.

@github-actions github-actions bot added J-awaiting answer Question asked of user; a reply moves it to triage again and removed A-needs-triaging A Selenium member will evaluate this soon! labels May 23, 2025
@nvborisenko
Copy link
Member Author

Hi bot! Nice to see you here, go away!

@cgoldberg
Copy link
Contributor

I can't speak for other bindings, but in Python the default level is WARNING. All of our logging is done at DEBUG level, so it is never shown unless you enable it.

@github-actions github-actions bot added A-needs-triaging A Selenium member will evaluate this soon! and removed J-awaiting answer Question asked of user; a reply moves it to triage again labels May 24, 2025
@nvborisenko
Copy link
Member Author

In .NET we have default Info level. meaning we always output Info/Warn/Error log messages. Info is not used at all because we don't know yet what log messages might be Info, we use Debug/Trace widely. But we use Warn/Error messages also, which comes to user's output.

This Bug/FeatureRequest is about it: it seems strange that library outputs something to my stderr by default. Selenium is a library, it is not an application. I don't mind that library may output something, but I should explicitly allow it.

I propose to turn off this behavior by default.

@diemol
Copy link
Member

diemol commented May 26, 2025

I think you should implement it in .NET because .NET did not have any logging for a long time. I wonder why logging started with Info and did not continue on the same path it had before.

Java is too verbose sometimes but I believe users are familiar with this and changing it might be a "breaking" change for them.

@nvborisenko
Copy link
Member Author

Many years ago Selenium/.NET did not provide logging capabilities. But there is a possibility to subscribe on events and do whatever user wants. So user is able to listen to some internal events. It is not ideal, and even not good: #15733

Now we have centralized logging mechanism, especially designed for logging purposes. Default level is aligned with other bindings (output Info/Warn/Error only), what means that all messages automatically comes to user's console output. And this is my concern: any library should not output to user's console. I am user, I see strange extra output in my console, I don't like it. Users don't like it (there are many issues about it, I will raise another story).

Summary:
Be silent by default, and become activated only when user:

OpenQA.Selenium.Internal.Logging.Log.SetLevel(LogEventLevel.Trace); // any level he wants

@nvborisenko
Copy link
Member Author

@RenderMichael @YevgeniyShunevych what do think about this issue?

@YevgeniyShunevych
Copy link
Contributor

I understand and support your concern about "any library should not output to user's console" by default. But in terms of consistency, I would also consider the common behavior across different WebDriver language bindings. If other language bindings write warnings and errors by default to console output, and there is a general agreement on this, so let it be for .NET as well. If there is no "general agreement"/"common approach" for default logging configuration, it may be disabled.

@nvborisenko
Copy link
Member Author

It was sort of agreement: https://www.selenium.dev/documentation/webdriver/troubleshooting/logging/, .NET did not want to be some special case. BTW logging in JavaScript is off by default.

I don't have strong opinion, just don't like that library puts something to my console. From other point of view I see warnings/errors only, so library pays my attention on really important things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-needs-triaging A Selenium member will evaluate this soon! I-defect Something is not working as intended I-regression Something was working but we "fixed" it
Projects
None yet
Development

No branches or pull requests

5 participants