diff --git a/dotnet/src/webdriver/Chromium/ChromiumDriver.cs b/dotnet/src/webdriver/Chromium/ChromiumDriver.cs index 79a179352bc75..097612e6a76d8 100644 --- a/dotnet/src/webdriver/Chromium/ChromiumDriver.cs +++ b/dotnet/src/webdriver/Chromium/ChromiumDriver.cs @@ -216,6 +216,15 @@ public DevToolsSession GetDevToolsSession(int devToolsProtocolVersion) return this.devToolsSession; } + public void TerminateDevToolsSession() + { + if (this.devToolsSession != null) + { + this.devToolsSession.Dispose(); + this.devToolsSession = null; + } + } + protected override void Dispose(bool disposing) { if (disposing) diff --git a/dotnet/src/webdriver/DevTools/IDevTools.cs b/dotnet/src/webdriver/DevTools/IDevTools.cs index aee113604635a..4a9e66cdcd172 100644 --- a/dotnet/src/webdriver/DevTools/IDevTools.cs +++ b/dotnet/src/webdriver/DevTools/IDevTools.cs @@ -35,5 +35,7 @@ public interface IDevTools /// The specific version of the Developer Tools debugging protocol to use. /// The active session to use to communicate with the Developer Tools debugging protocol. DevToolsSession GetDevToolsSession(int protocolVersion); + + void TerminateDevToolsSession(); } } diff --git a/dotnet/src/webdriver/Firefox/FirefoxDriver.cs b/dotnet/src/webdriver/Firefox/FirefoxDriver.cs index 8f3085228961e..acf7579725171 100644 --- a/dotnet/src/webdriver/Firefox/FirefoxDriver.cs +++ b/dotnet/src/webdriver/Firefox/FirefoxDriver.cs @@ -300,6 +300,15 @@ public DevToolsSession GetDevToolsSession(int devToolsProtocolVersion) return this.devToolsSession; } + public void TerminateDevToolsSession() + { + if (this.devToolsSession != null) + { + this.devToolsSession.Dispose(); + this.devToolsSession = null; + } + } + /// /// In derived classes, the method prepares the environment for test execution. /// diff --git a/dotnet/src/webdriver/Remote/RemoteWebDriver.cs b/dotnet/src/webdriver/Remote/RemoteWebDriver.cs index f006b3b311876..8dd0e18195f23 100644 --- a/dotnet/src/webdriver/Remote/RemoteWebDriver.cs +++ b/dotnet/src/webdriver/Remote/RemoteWebDriver.cs @@ -444,6 +444,15 @@ public DevToolsSession GetDevToolsSession(int protocolVersion) return this.devToolsSession; } + public void TerminateDevToolsSession() + { + if (this.devToolsSession != null) + { + this.devToolsSession.Dispose(); + this.devToolsSession = null; + } + } + private static ICapabilities ConvertOptionsToCapabilities(DriverOptions options) { if (options == null)