Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[dotnet] Suppress unwanted messages from browser via redirecting streams #16265

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 wants to merge 2 commits into SeleniumHQ:trunk
base: trunk
Choose a base branch
Loading
from nvborisenko:dotnet-suppress-chromium-stdio

Conversation

Copy link
Member

@nvborisenko nvborisenko commented Aug 27, 2025
edited by qodo-merge-pro bot
Loading

User description

🔗 Related Issues

Contributes to #16201

💡 Additional Considerations

🔄 Types of changes

  • Cleanup (formatting, renaming)

PR Type

Enhancement


Description

  • Add --enable-chrome-logs flag to ChromiumDriverService

  • Redirect browser logs to driver process output

  • Suppress unwanted browser messages in console


Diagram Walkthrough

flowchart LR
 A["ChromiumDriverService"] -- "adds flag" --> B["--enable-chrome-logs"]
 B -- "redirects" --> C["Browser logs to driver process"]
Loading

File Walkthrough

Relevant files
Enhancement
ChromiumDriverService.cs
Add browser log redirection flag

dotnet/src/webdriver/Chromium/ChromiumDriverService.cs

  • Added --enable-chrome-logs command line argument
  • Unconditionally redirects browser logs to driver process
  • Added explanatory comment for the new flag
+2/-0

@selenium-ci selenium-ci added the C-dotnet .NET Bindings label Aug 27, 2025
Copy link
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

16201 - Partially compliant

Compliant requirements:

  • Add the --enable-chrome-logs flag when starting chromedriver across non-JS bindings.
  • Ensure browser i/o streams can be redirected/suppressed by inheriting them in the driver process.

Non-compliant requirements:

  • Consider whether Edge (Chromium-based) needs similar handling.

Requires further human verification:

  • Confirm at runtime that logs are indeed redirected/suppressed as expected across platforms (Windows, macOS, Linux).
  • Validate no regressions in driver startup when --enable-chrome-logs is present with various Chrome versions.
⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
Recommended focus areas for review

Behavior Change

The flag is added unconditionally, which may alter existing user expectations or custom logging setups. Verify this does not break scenarios where users relied on previous stdout/err behavior or where ChromeDriver rejects unknown flags in certain versions.

// Unconditionally redirect browser logs to the same log as the driver
argsBuilder.Append(" --enable-chrome-logs");
Cross-Browser Impact

ChromiumDriverService could be used for other Chromium-based browsers; confirm that --enable-chrome-logs is accepted by all targeted Chromium derivatives (e.g., Edge) or gate per browser if needed.

// Unconditionally redirect browser logs to the same log as the driver
argsBuilder.Append(" --enable-chrome-logs");

Copy link
Contributor

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion Impact
General
Gate flag on log file presence

Only append this flag when a driver log sink is configured; otherwise, browser
logs will be redirected to stderr, potentially spamming console output and
defeating the goal of suppression. Gate it on LogPath being set and adjust the
comment accordingly. This prevents unexpected noise in environments where no log
file is configured.

dotnet/src/webdriver/Chromium/ChromiumDriverService.cs [166-167]

-// Unconditionally redirect browser logs to the same log as the driver
-argsBuilder.Append(" --enable-chrome-logs");
+if (!string.IsNullOrEmpty(this.LogPath))
+{
+ // Redirect browser logs to the same log as the driver
+ argsBuilder.Append(" --enable-chrome-logs");
+}
  • Apply / Chat
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly points out that unconditionally adding --enable-chrome-logs could spam the console if LogPath is not set, and the proposed conditional check is a sensible improvement to prevent this side effect.

Medium
  • More

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /