Skip to content

[dotnet] Hide unnecessary chromium public fields#17113

Merged
nvborisenko merged 2 commits intoSeleniumHQ:trunkfrom
nvborisenko:dotnet-chromium-static-fields
Mar 13, 2026
Merged

[dotnet] Hide unnecessary chromium public fields#17113
nvborisenko merged 2 commits intoSeleniumHQ:trunkfrom
nvborisenko:dotnet-chromium-static-fields

Conversation

@nvborisenko
Copy link
Copy Markdown
Member

This pull request makes a small but important change to the ChromiumDriver class by changing the visibility of several static fields from public to protected. This limits their accessibility to the class itself and its subclasses, rather than exposing them publicly.

  • Changed the visibility of the following static fields from public to protected in ChromiumDriver.cs:
    • AcceptUntrustedCertificates
    • ExecuteCdp
    • GetCastSinksCommand
    • SelectCastSinkCommand
    • StartCastTabMirroringCommand
    • StartCastDesktopMirroringCommand
    • GetCastIssueMessageCommand
    • StopCastingCommand
    • GetNetworkConditionsCommand
    • SetNetworkConditionsCommand
    • DeleteNetworkConditionsCommand
    • SendChromeCommand
    • SendChromeCommandWithResult
    • LaunchAppCommand
    • SetPermissionCommand

💡 Additional Considerations

Hopefully nobody even knows it exists. So just "remove".

🔄 Types of changes

  • Cleanup (formatting, renaming)
  • Breaking change (fix or feature that would cause existing functionality to change)

Copilot AI review requested due to automatic review settings February 18, 2026 22:10
@qodo-code-review
Copy link
Copy Markdown
Contributor

PR Type

Enhancement


Description

  • Reduce public API surface by hiding internal Chromium fields

  • Change 15 static fields from public to protected visibility

  • Prevent external code from depending on internal implementation details


File Walkthrough

Relevant files
Enhancement
ChromiumDriver.cs
Reduce public API surface for Chromium driver                       

dotnet/src/webdriver/Chromium/ChromiumDriver.cs

  • Changed visibility of 15 static readonly fields from public to
    protected
  • Fields include command constants and configuration flags used
    internally
  • Maintains functionality while reducing public API surface
  • Affects: AcceptUntrustedCertificates, ExecuteCdp, GetCastSinksCommand,
    SelectCastSinkCommand, StartCastTabMirroringCommand,
    StartCastDesktopMirroringCommand, GetCastIssueMessageCommand,
    StopCastingCommand, GetNetworkConditionsCommand,
    SetNetworkConditionsCommand, DeleteNetworkConditionsCommand,
    SendChromeCommand, SendChromeCommandWithResult, LaunchAppCommand,
    SetPermissionCommand
+15/-15 

@qodo-code-review
Copy link
Copy Markdown
Contributor

qodo-code-review Bot commented Feb 18, 2026

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
No custom compliance provided

Follow the guide to enable custom compliance check.

  • Update
Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@qodo-code-review
Copy link
Copy Markdown
Contributor

qodo-code-review Bot commented Feb 18, 2026

PR Code Suggestions ✨

No code suggestions found for the PR.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reduces the public API surface of the .NET ChromiumDriver by changing several command-name/static fields from public to protected, limiting access to subclasses (e.g., ChromeDriver, EdgeDriver) rather than all consumers.

Changes:

  • Changed multiple ChromiumDriver static fields (command names and AcceptUntrustedCertificates) from public to protected.

Comment thread dotnet/src/webdriver/Chromium/ChromiumDriver.cs Outdated
@nvborisenko nvborisenko merged commit 29cb4c2 into SeleniumHQ:trunk Mar 13, 2026
18 of 19 checks passed
@nvborisenko nvborisenko deleted the dotnet-chromium-static-fields branch March 13, 2026 11:22
krishnamohan-kothapalli pushed a commit to krishnamohan-kothapalli/selenium that referenced this pull request Mar 18, 2026
@drauch
Copy link
Copy Markdown

drauch commented Apr 13, 2026

We're using SendChromeCommand to clear all cookies in all domains via "Network.clearBrowserCookies". How is this to be done going forward?

Best regard,
D.R.

@nvborisenko
Copy link
Copy Markdown
Member Author

@drauch

chrome.ExecuteCdpCommand("Network.clearBrowserCookies", []);

@drauch
Copy link
Copy Markdown

drauch commented Apr 13, 2026

Ah, it looked like ExecudeCdpCommand was obsoleted as well.

@nvborisenko
Copy link
Copy Markdown
Member Author

Ah, it looked like ExecudeCdpCommand was obsoleted as well.

still actual:

public object? ExecuteCdpCommand(string commandName, Dictionary<string, object?> commandParameters)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants