Skip to content

Commit 8f725b3

Browse files
[dotnet] Add CDP deprecation warning for Firefox (#14759)
Co-authored-by: Nikolay Borisenko <[email protected]>
1 parent 673d2c7 commit 8f725b3

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

dotnet/src/webdriver/Firefox/FirefoxDriver.cs

+1
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ public DevToolsSession GetDevToolsSession(int devToolsProtocolVersion)
413413
/// Creates a session to communicate with a browser using a Developer Tools debugging protocol.
414414
/// </summary>
415415
/// <returns>The active session to use to communicate with the Developer Tools debugging protocol.</returns>
416+
[Obsolete("CDP support for Firefox is deprecated and will be removed in future versions. Please switch to WebDriver BiDi.")]
416417
public DevToolsSession GetDevToolsSession(DevToolsOptions options)
417418
{
418419
if (this.devToolsSession == null)

dotnet/src/webdriver/Remote/RemoteWebDriver.cs

+11
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
// under the License.
1818
// </copyright>
1919

20+
using OpenQA.Selenium.Internal.Logging;
2021
using OpenQA.Selenium.DevTools;
2122
using System;
2223
using System.Collections.Generic;
@@ -63,6 +64,8 @@ namespace OpenQA.Selenium.Remote
6364
/// </example>
6465
public class RemoteWebDriver : WebDriver, IDevTools, IHasDownloads
6566
{
67+
private static readonly ILogger _logger = OpenQA.Selenium.Internal.Logging.Log.GetLogger(typeof(RemoteWebDriver));
68+
6669
/// <summary>
6770
/// The name of the Selenium grid remote DevTools end point capability.
6871
/// </summary>
@@ -425,6 +428,14 @@ public ReadOnlyCollection<IWebElement> FindElementsByCssSelector(string cssSelec
425428
/// <returns>The active session to use to communicate with the Developer Tools debugging protocol.</returns>
426429
public DevToolsSession GetDevToolsSession()
427430
{
431+
if (this.Capabilities.GetCapability(CapabilityType.BrowserName) == "firefox")
432+
{
433+
if (_logger.IsEnabled(LogEventLevel.Warn))
434+
{
435+
_logger.Warn("CDP support for Firefox is deprecated and will be removed in future versions. Please switch to WebDriver BiDi.");
436+
}
437+
}
438+
428439
return GetDevToolsSession(new DevToolsOptions() { ProtocolVersion = DevToolsSession.AutoDetectDevToolsProtocolVersion });
429440
}
430441

0 commit comments

Comments
 (0)