Skip to content

Commit c5991c4

Browse files
authored
Merge branch 'SeleniumHQ:trunk' into py-fix-remote-tests
2 parents 774d4c3 + f7aa586 commit c5991c4

File tree

11 files changed

+25
-22
lines changed

11 files changed

+25
-22
lines changed

dotnet/src/webdriver/Firefox/FirefoxOptions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ public FirefoxOptions()
8383
this.AddKnownCapabilityName(FirefoxOptions.FirefoxLegacyProfileCapability, "Profile property");
8484
this.AddKnownCapabilityName(FirefoxOptions.FirefoxLegacyBinaryCapability, "BrowserExecutableLocation property");
8585
this.AddKnownCapabilityName(FirefoxOptions.FirefoxEnableDevToolsProtocolCapability, "EnableDevToolsProtocol property");
86-
// Firefox 129 onwards the CDP protocol will not be enabled by default. Setting this preference will enable it.
8786
// https://fxdx.dev/deprecating-cdp-support-in-firefox-embracing-the-future-with-webdriver-bidi/.
88-
this.SetPreference("remote.active-protocols", 3);
87+
// Enable BiDi only
88+
this.SetPreference("remote.active-protocols", 1);
8989
}
9090

9191
/// <summary>

java/src/org/openqa/selenium/remote/http/jdk/JdkHttpClient.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,13 @@ public WebSocket openSocket(HttpRequest request, WebSocket.Listener listener) {
166166
throw new ConnectionFailedException("JdkWebSocket initial request execution error", e);
167167
}
168168

169+
java.net.http.WebSocket.Builder builder = client.newWebSocketBuilder();
170+
171+
request.getHeaderNames().forEach(name -> builder.header(name, request.getHeader(name)));
172+
169173
CompletableFuture<Integer> closed = new CompletableFuture<>();
170174
CompletableFuture<java.net.http.WebSocket> webSocketCompletableFuture =
171-
client
172-
.newWebSocketBuilder()
175+
builder
173176
.connectTimeout(connectTimeout)
174177
.buildAsync(
175178
uri,

javascript/selenium-webdriver/firefox.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,9 @@ class Options extends Capabilities {
247247
constructor(other) {
248248
super(other)
249249
this.setBrowserName(Browser.FIREFOX)
250-
// Firefox 129 onwards the CDP protocol will not be enabled by default. Setting this preference will enable it.
251250
// https://fxdx.dev/deprecating-cdp-support-in-firefox-embracing-the-future-with-webdriver-bidi/.
252-
this.setPreference('remote.active-protocols', 3)
251+
// Enable BiDi only
252+
this.setPreference('remote.active-protocols', 1)
253253
}
254254

255255
/**

javascript/selenium-webdriver/test/firefox/options_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ suite(
9090
assert.deepStrictEqual(
9191
{
9292
androidPackage: 'org.mozilla.firefox',
93-
prefs: { 'remote.active-protocols': 3 },
93+
prefs: { 'remote.active-protocols': 1 },
9494
},
9595
firefoxOptions,
9696
)

py/selenium/webdriver/firefox/options.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ def __init__(self) -> None:
4444
super().__init__()
4545
self._binary_location = ""
4646
self._preferences: dict = {}
47-
# Firefox 129 onwards the CDP protocol will not be enabled by default. Setting this preference will enable it.
4847
# https://fxdx.dev/deprecating-cdp-support-in-firefox-embracing-the-future-with-webdriver-bidi/.
49-
self._preferences["remote.active-protocols"] = 3
48+
# Enable BiDi only
49+
self._preferences["remote.active-protocols"] = 1
5050
self._profile: Optional[FirefoxProfile] = None
5151
self.log = Log()
5252

py/test/selenium/webdriver/marionette/mn_options_tests.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class TestUnit:
4242
def test_ctor(self):
4343
opts = Options()
4444
assert opts.binary_location == ""
45-
assert opts._preferences == {"remote.active-protocols": 3}
45+
assert opts._preferences == {"remote.active-protocols": 1}
4646
assert opts._profile is None
4747
assert not opts._arguments
4848
assert isinstance(opts.log, Log)
@@ -72,7 +72,7 @@ def test_prefs(self):
7272
assert len(opts.preferences) == 3
7373
opts.set_preference("spam", "spam")
7474
assert len(opts.preferences) == 3
75-
assert opts.preferences == {"eggs": True, "remote.active-protocols": 3, "spam": "spam"}
75+
assert opts.preferences == {"eggs": True, "remote.active-protocols": 1, "spam": "spam"}
7676

7777
def test_profile(self, tmpdir_factory):
7878
opts = Options()
@@ -102,7 +102,7 @@ def test_to_capabilities(self):
102102
firefox_caps.update(
103103
{
104104
"pageLoadStrategy": PageLoadStrategy.normal,
105-
"moz:firefoxOptions": {"prefs": {"remote.active-protocols": 3}},
105+
"moz:firefoxOptions": {"prefs": {"remote.active-protocols": 1}},
106106
}
107107
)
108108
assert opts.to_capabilities() == firefox_caps

py/test/unit/selenium/webdriver/firefox/firefox_options_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def test_set_proxy_isnt_in_moz_prefix(options):
7979

8080
caps = options.to_capabilities()
8181
assert caps["proxy"]["proxyType"] == "manual"
82-
assert caps.get("moz:firefoxOptions") == {"prefs": {"remote.active-protocols": 3}}
82+
assert caps.get("moz:firefoxOptions") == {"prefs": {"remote.active-protocols": 1}}
8383

8484

8585
def test_raises_exception_if_proxy_is_not_proxy_object(options):

py/test/unit/selenium/webdriver/remote/new_session_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def test_first_match_when_2_different_option_types():
103103
"browserName": "firefox",
104104
"acceptInsecureCerts": True,
105105
"moz:debuggerAddress": True,
106-
"moz:firefoxOptions": {"args": ["foo"], "prefs": {"remote.active-protocols": 3}},
106+
"moz:firefoxOptions": {"args": ["foo"], "prefs": {"remote.active-protocols": 1}},
107107
},
108108
],
109109
}

rb/lib/selenium/webdriver/firefox/options.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ def initialize(log_level: nil, **opts)
6464

6565
@options[:args] ||= []
6666
@options[:prefs] ||= {}
67-
# Firefox 129 onwards the CDP protocol will not be enabled by default. Setting this preference will enable it.
6867
# https://fxdx.dev/deprecating-cdp-support-in-firefox-embracing-the-future-with-webdriver-bidi/.
69-
@options[:prefs]['remote.active-protocols'] = 3
68+
# Enable BiDi only
69+
@options[:prefs]['remote.active-protocols'] = 1
7070
@options[:env] ||= {}
7171
@options[:log] ||= {level: log_level} if log_level
7272

rb/spec/unit/selenium/webdriver/firefox/driver_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ module Firefox
3838
def expect_request(body: nil, endpoint: nil)
3939
body = (body || {capabilities: {alwaysMatch: {acceptInsecureCerts: true,
4040
browserName: 'firefox',
41-
'moz:firefoxOptions': {prefs: {'remote.active-protocols' => 3}},
41+
'moz:firefoxOptions': {prefs: {'remote.active-protocols' => 1}},
4242
'moz:debuggerAddress': true}}}).to_json
4343
endpoint ||= "#{service_manager.uri}/session"
4444
stub_request(:post, endpoint).with(body: body).to_return(valid_response)
@@ -81,7 +81,7 @@ def expect_request(body: nil, endpoint: nil)
8181
browserName: 'firefox',
8282
'moz:firefoxOptions': {
8383
args: ['-f'],
84-
prefs: {'remote.active-protocols' => 3}
84+
prefs: {'remote.active-protocols' => 1}
8585
},
8686
'moz:debuggerAddress': true}}})
8787
expect { described_class.new(options: Options.new(**opts)) }.not_to raise_exception

0 commit comments

Comments
 (0)