[dotnet] Fix stopping of network monitoring via DevTools#17352
[dotnet] Fix stopping of network monitoring via DevTools#17352nvborisenko merged 2 commits intoSeleniumHQ:trunkfrom
Conversation
Review Summary by QodoFix network monitoring cleanup in .NET WebDriver
WalkthroughsDescription• Explicitly disable network and fetch domains in StopMonitoring() • Verify network interception cleanup after monitoring stops • Ensure proper removal of network interception hooks File Changes1. dotnet/src/webdriver/NetworkManager.cs
|
Code Review by Qodo
|
There was a problem hiding this comment.
Pull request overview
Fixes cleanup of DevTools-based network monitoring so that interception doesn’t leave subsequent requests stuck pending, and extends a regression test to confirm monitoring teardown restores normal network behavior.
Changes:
- Explicitly disables the CDP Network and Fetch domains when stopping monitoring.
- Extends the network interception test to refresh and verify the original page content is restored after monitoring stops.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| dotnet/src/webdriver/NetworkManager.cs | Ensures monitoring teardown disables the relevant CDP domains, not just event unsubscription/caching reset. |
| dotnet/test/webdriver/NetworkInterceptionTests.cs | Adds a post-StopMonitoring refresh/assertion to validate interception no longer affects subsequent loads. |
|
Finally |
🔗 Related Issues
Fixes #17350
💥 What does this PR do?
This pull request makes improvements to network monitoring cleanup and enhances test coverage for network interception in the WebDriver codebase. The main changes ensure that network and fetch domains are properly disabled when monitoring stops and that tests verify network state resets after interception.
Network monitoring cleanup:
NetworkManager.cs: Added calls to explicitly disable the network and fetch domains inStopMonitoring()to ensure all network interception hooks are removed when monitoring ends.Test improvements:
NetworkInterceptionTests.cs: Enhanced theTestCanInterceptNetworkCallstest to refresh the page and verify that network interception no longer affects subsequent requests, ensuring proper cleanup.🔄 Types of changes