Skip to content

[dotnet] [bidi] Remove high-level network interception#17288

Merged
nvborisenko merged 2 commits intoSeleniumHQ:trunkfrom
nvborisenko:bidi-remove-highlevel-network
Apr 1, 2026
Merged

[dotnet] [bidi] Remove high-level network interception#17288
nvborisenko merged 2 commits intoSeleniumHQ:trunkfrom
nvborisenko:bidi-remove-highlevel-network

Conversation

@nvborisenko
Copy link
Copy Markdown
Member

Remove bidi.Network.Intercept*(...)

🔗 Related Issues

Contributes to #16095

💥 What does this PR do?

This pull request refactors the network interception API in the BiDi WebDriver implementation. The main change is the removal of the high-level interception methods (InterceptRequestAsync, InterceptResponseAsync, InterceptAuthAsync) from both the NetworkModule and BrowsingContextNetworkModule classes, along with their associated option and event argument types. Instead, interception is now handled through lower-level methods like AddInterceptAsync and event subscriptions. Test cases have been updated accordingly to use the new API.

Key changes include:

API Refactoring and Cleanup

  • Removed the high-level interception methods (InterceptRequestAsync, InterceptResponseAsync, InterceptAuthAsync) and their associated option types from NetworkModule, BrowsingContextNetworkModule, and their interfaces. Interception is now performed using AddInterceptAsync and event handlers. [1] [2] [3] [4] [5]

Test Updates

  • Refactored all affected tests in NetworkTests.cs to use AddInterceptAsync and explicit event subscriptions instead of the removed high-level interception methods. This includes updating assertions and the flow of interception handling. [1] [2] [3] [4] [5]

These changes simplify the interception API, making it more explicit and flexible, while keeping the test coverage up-to-date with the new approach.

💡 Additional Considerations

Can/Will? be implemented via extensions.

🔄 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 April 1, 2026 14:45
@selenium-ci selenium-ci added the C-dotnet .NET Bindings label Apr 1, 2026
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

Refactors the .NET BiDi Network interception API by removing the high-level Intercept*Async(...) helpers and their related types, pushing consumers toward AddInterceptAsync(...) plus explicit event subscriptions.

Changes:

  • Removed high-level interception methods/types from NetworkModule, BrowsingContextNetworkModule, and their interfaces.
  • Deleted the NetworkModule.HighLevel.cs implementation (including the Interception helper wrapper and Intercepted* event-arg wrappers).
  • Updated BiDi network tests to use AddInterceptAsync(...) and On*Async(...) subscriptions.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
dotnet/test/webdriver/BiDi/Network/NetworkTests.cs Migrates interception tests to the lower-level intercept + event subscription model.
dotnet/src/webdriver/BiDi/Network/NetworkModule.HighLevel.cs Removes the high-level interception API surface and helper types.
dotnet/src/webdriver/BiDi/Network/INetworkModule.cs Removes Intercept*Async(...) members from the public network module interface.
dotnet/src/webdriver/BiDi/BrowsingContext/IBrowsingContextNetworkModule.cs Removes Intercept*Async(...) members from the browsing-context scoped network interface.
dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextNetworkModule.cs Removes browsing-context high-level interception wrappers and related option records.

@nvborisenko nvborisenko merged commit 4a4c593 into SeleniumHQ:trunk Apr 1, 2026
18 of 19 checks passed
@nvborisenko nvborisenko deleted the bidi-remove-highlevel-network branch April 1, 2026 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-dotnet .NET Bindings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants