Skip to content

Commit

Permalink
Add preference to enable CDP in Firefox by default
Browse files Browse the repository at this point in the history
Related to SeleniumHQ#11736
  • Loading branch information
pujagani committed Jun 11, 2024
1 parent 734cca0 commit c994624
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dotnet/src/webdriver/Firefox/FirefoxOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ public FirefoxOptions()
this.AddKnownCapabilityName(FirefoxOptions.FirefoxLegacyProfileCapability, "Profile property");
this.AddKnownCapabilityName(FirefoxOptions.FirefoxLegacyBinaryCapability, "BrowserExecutableLocation property");
this.AddKnownCapabilityName(FirefoxOptions.FirefoxEnableDevToolsProtocolCapability, "EnableDevToolsProtocol property");
// Firefox 129 onwards the CDP protocol will not be enabled by default. Setting this preference will enable it.
// https://fxdx.dev/deprecating-cdp-support-in-firefox-embracing-the-future-with-webdriver-bidi/.
this.SetPreference("remote.active-protocols", 2);
}

/// <summary>
Expand Down
4 changes: 4 additions & 0 deletions java/src/org/openqa/selenium/firefox/FirefoxOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ public FirefoxOptions() {
setCapability(CapabilityType.BROWSER_NAME, FIREFOX.browserName());
setAcceptInsecureCerts(true);
setCapability("moz:debuggerAddress", true);
// Firefox 129 onwards the CDP protocol will not be enabled by default. Setting this preference
// will enable it.
// https://fxdx.dev/deprecating-cdp-support-in-firefox-embracing-the-future-with-webdriver-bidi/.
addPreference("remote.active-protocols", 2);
}

public FirefoxOptions(Capabilities source) {
Expand Down
3 changes: 3 additions & 0 deletions javascript/node/selenium-webdriver/firefox.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ class Options extends Capabilities {
constructor(other) {
super(other)
this.setBrowserName(Browser.FIREFOX)
// Firefox 129 onwards the CDP protocol will not be enabled by default. Setting this preference will enable it.
// https://fxdx.dev/deprecating-cdp-support-in-firefox-embracing-the-future-with-webdriver-bidi/.
this.setPreference('remote.active-protocols', 2)
}

/**
Expand Down
3 changes: 3 additions & 0 deletions py/selenium/webdriver/firefox/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ def __init__(self) -> None:
super().__init__()
self._binary_location = ""
self._preferences: dict = {}
# Firefox 129 onwards the CDP protocol will not be enabled by default. Setting this preference will enable it.
# https://fxdx.dev/deprecating-cdp-support-in-firefox-embracing-the-future-with-webdriver-bidi/.
self._preferences["remote.active-protocols"] = 2
self._profile = None
self.log = Log()

Expand Down
3 changes: 3 additions & 0 deletions rb/lib/selenium/webdriver/firefox/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ def initialize(log_level: nil, **opts)

@options[:args] ||= []
@options[:prefs] ||= {}
# Firefox 129 onwards the CDP protocol will not be enabled by default. Setting this preference will enable it.
# https://fxdx.dev/deprecating-cdp-support-in-firefox-embracing-the-future-with-webdriver-bidi/.
@options[:prefs]['remote.active-protocols'] = 2
@options[:env] ||= {}
@options[:log] ||= {level: log_level} if log_level

Expand Down

0 comments on commit c994624

Please sign in to comment.