Skip to content

Commit ab880df

Browse files
authored
Merge branch 'trunk' into java-websocket-port-bidi
2 parents e8b6efa + c1defad commit ab880df

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1453
-675
lines changed

.skipped-tests

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
-//dotnet/test/common:NetworkInterceptionTests-chrome
22
-//dotnet/test/common:NetworkInterceptionTests-edge
3+
-//dotnet/test/firefox:FirefoxDriverTest-firefox
34
-//java/test/org/openqa/selenium/chrome:ChromeDriverFunctionalTest
45
-//java/test/org/openqa/selenium/chrome:ChromeDriverFunctionalTest-remote
56
-//java/test/org/openqa/selenium/edge:EdgeDriverFunctionalTest

common/repositories.bzl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ js_library(
5050

5151
http_archive(
5252
name = "linux_beta_firefox",
53-
url = "https://ftp.mozilla.org/pub/firefox/releases/141.0b8/linux-x86_64/en-US/firefox-141.0b8.tar.xz",
54-
sha256 = "6d7bd30cf503c00a1e54343caf8a6606b48e939820bbe3cc01f0f986c60c1911",
53+
url = "https://ftp.mozilla.org/pub/firefox/releases/141.0b9/linux-x86_64/en-US/firefox-141.0b9.tar.xz",
54+
sha256 = "5a89acdfeecef444ff167635308fde601317331a6537ba379897b77a636496be",
5555
build_file_content = """
5656
load("@aspect_rules_js//js:defs.bzl", "js_library")
5757
package(default_visibility = ["//visibility:public"])
@@ -72,8 +72,8 @@ js_library(
7272

7373
dmg_archive(
7474
name = "mac_beta_firefox",
75-
url = "https://ftp.mozilla.org/pub/firefox/releases/141.0b8/mac/en-US/Firefox%20141.0b8.dmg",
76-
sha256 = "a6e3184ad3fef2c95b57d553c2794f2cb6dbddb20969e3d78316ef6f8c2ce569",
75+
url = "https://ftp.mozilla.org/pub/firefox/releases/141.0b9/mac/en-US/Firefox%20141.0b9.dmg",
76+
sha256 = "e105272ffa164d501a78b3a407fef1afcac80cab4b9e03de07f3599e8ce39588",
7777
build_file_content = """
7878
load("@aspect_rules_js//js:defs.bzl", "js_library")
7979
package(default_visibility = ["//visibility:public"])
@@ -165,8 +165,8 @@ js_library(
165165

166166
http_archive(
167167
name = "linux_edgedriver",
168-
url = "https://msedgedriver.azureedge.net/138.0.3351.77/edgedriver_linux64.zip",
169-
sha256 = "4dfbddfb6cabe44da0214d464e0421bbbeada428ddd95a60a2aa245074230ddf",
168+
url = "https://msedgedriver.microsoft.com/138.0.3351.83/edgedriver_linux64.zip",
169+
sha256 = "ed7d3651a5087bf7cdd383c244de29fa9e6a347473ff53c0172583380c5f7256",
170170
build_file_content = """
171171
load("@aspect_rules_js//js:defs.bzl", "js_library")
172172
package(default_visibility = ["//visibility:public"])
@@ -182,8 +182,8 @@ js_library(
182182

183183
http_archive(
184184
name = "mac_edgedriver",
185-
url = "https://msedgedriver.azureedge.net/138.0.3351.77/edgedriver_mac64.zip",
186-
sha256 = "57a0dbd5ce37cf2600410307e91c09f6eb78746cc02221e7309e0a6feb37725f",
185+
url = "https://msedgedriver.microsoft.com/138.0.3351.83/edgedriver_mac64.zip",
186+
sha256 = "a9e267a880300ed8dc77fc4ff12d4a66b49e3443d23c1091af277f332b2fc041",
187187
build_file_content = """
188188
load("@aspect_rules_js//js:defs.bzl", "js_library")
189189
package(default_visibility = ["//visibility:public"])

common/selenium_manager.bzl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,22 @@ def selenium_manager():
66
http_file(
77
name = "download_sm_linux",
88
executable = True,
9-
sha256 = "50099355b0e74b8bb231a5b152fc3de498dcde1cdebcefb1e501713e9b124b9d",
10-
url = "https://github.com/SeleniumHQ/selenium_manager_artifacts/releases/download/selenium-manager-0ab9b6d/selenium-manager-linux",
9+
sha256 = "f615ae2eea714a54e322f8945c7abb19e03e0f5d651b464bd5cd9e9ecf9e7c90",
10+
url = "https://github.com/SeleniumHQ/selenium_manager_artifacts/releases/download/selenium-manager-9d09338/selenium-manager-linux",
1111
)
1212

1313
http_file(
1414
name = "download_sm_macos",
1515
executable = True,
16-
sha256 = "eb98ce344acfaee3a7d58038331a8b49985ac724d2a9ec02258008c076979846",
17-
url = "https://github.com/SeleniumHQ/selenium_manager_artifacts/releases/download/selenium-manager-0ab9b6d/selenium-manager-macos",
16+
sha256 = "88fede46d14991930aab3176f6938ddb7549ab244f6d75a9745050d625274852",
17+
url = "https://github.com/SeleniumHQ/selenium_manager_artifacts/releases/download/selenium-manager-9d09338/selenium-manager-macos",
1818
)
1919

2020
http_file(
2121
name = "download_sm_windows",
2222
executable = True,
23-
sha256 = "7090d5737aebabb9daad49022b070d3456b8e43ae7f3ac5bcb780af67c371b3f",
24-
url = "https://github.com/SeleniumHQ/selenium_manager_artifacts/releases/download/selenium-manager-0ab9b6d/selenium-manager-windows.exe",
23+
sha256 = "a7e8a7e0f561e7d8238f8aa884ef2dd6235884d3b0e97f25061747dbf4ec5037",
24+
url = "https://github.com/SeleniumHQ/selenium_manager_artifacts/releases/download/selenium-manager-9d09338/selenium-manager-windows.exe",
2525
)
2626

2727
def _selenium_manager_artifacts_impl(_ctx):

dotnet/src/webdriver/BUILD.bazel

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -162,21 +162,21 @@ csharp_library(
162162
)
163163

164164
copy_file(
165-
name = "readme",
166-
src = "//dotnet/src/webdriver/assets:README.md",
165+
name = "assets-nuget-readme",
166+
src = "//dotnet/src/webdriver/assets:nuget/README.md",
167167
out = "README.md",
168168
)
169169

170170
copy_file(
171-
name = "props",
172-
src = "//dotnet/src/webdriver/assets:Selenium.WebDriver.targets",
171+
name = "assets-nuget-build-netstandard20-targets",
172+
src = "//dotnet/src/webdriver/assets:nuget/build/netstandard2.0/Selenium.WebDriver.targets",
173173
out = "Selenium.WebDriver.targets",
174174
)
175175

176176
copy_file(
177-
name = "transitive-props",
178-
src = "//dotnet/src/webdriver/assets:Selenium.WebDriver.targets",
179-
out = "transitive.Selenium.WebDriver.targets",
177+
name = "assets-nuget-buildtransitive-netstandard20-targets",
178+
src = "//dotnet/src/webdriver/assets:nuget/buildTransitive/netstandard2.0/Selenium.WebDriver.targets",
179+
out = "transitiveSelenium.WebDriver.targets",
180180
)
181181

182182
copy_file(
@@ -207,9 +207,9 @@ nuget_pack(
207207
"//common/manager:selenium-manager-linux": "manager/linux/selenium-manager",
208208
"//common/manager:selenium-manager-macos": "manager/macos/selenium-manager",
209209
"//common/manager:selenium-manager-windows": "manager/windows/selenium-manager.exe",
210-
":readme": "README.md",
211-
":props": "build/Selenium.WebDriver.targets",
212-
":transitive-props": "buildTransitive/Selenium.WebDriver.targets",
210+
":assets-nuget-readme": "README.md",
211+
":assets-nuget-build-netstandard20-targets": "build/netstandard2.0/Selenium.WebDriver.targets",
212+
":assets-nuget-buildtransitive-netstandard20-targets": "buildTransitive/netstandard2.0/Selenium.WebDriver.targets",
213213
},
214214
id = "Selenium.WebDriver",
215215
libs = {
@@ -233,9 +233,9 @@ nuget_pack(
233233
"//common/manager:selenium-manager-linux": "manager/linux/selenium-manager",
234234
"//common/manager:selenium-manager-macos": "manager/macos/selenium-manager",
235235
"//common/manager:selenium-manager-windows": "manager/windows/selenium-manager.exe",
236-
":readme": "README.md",
237-
":props": "build/Selenium.WebDriver.StrongNamed.targets",
238-
":transitive-props": "buildTransitive/Selenium.WebDriver.StrongNamed.targets",
236+
":assets-nuget-readme": "README.md",
237+
":assets-nuget-build-netstandard20-targets": "build/netstandard2.0/Selenium.WebDriver.StrongNamed.targets",
238+
":assets-nuget-buildtransitive-netstandard20-targets": "buildTransitive/netstandard2.0/Selenium.WebDriver.StrongNamed.targets",
239239
},
240240
id = "Selenium.WebDriver.StrongNamed",
241241
libs = {

dotnet/src/webdriver/BiDi/BiDi.cs

Lines changed: 27 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
// </copyright>
1919

2020
using System;
21+
using System.Threading;
2122
using System.Threading.Tasks;
2223
using OpenQA.Selenium.BiDi.Communication;
2324

@@ -38,7 +39,7 @@ public class BiDi : IAsyncDisposable
3839

3940
private readonly object _moduleLock = new();
4041

41-
internal BiDi(string url)
42+
private BiDi(string url)
4243
{
4344
var uri = new Uri(url);
4445

@@ -49,15 +50,10 @@ internal Session.SessionModule SessionModule
4950
{
5051
get
5152
{
52-
if (_sessionModule is null)
53+
if (_sessionModule is not null) return _sessionModule;
54+
lock (_moduleLock)
5355
{
54-
lock (_moduleLock)
55-
{
56-
if (_sessionModule is null)
57-
{
58-
_sessionModule = new Session.SessionModule(_broker);
59-
}
60-
}
56+
_sessionModule ??= new Session.SessionModule(_broker);
6157
}
6258
return _sessionModule;
6359
}
@@ -67,15 +63,10 @@ public BrowsingContext.BrowsingContextModule BrowsingContext
6763
{
6864
get
6965
{
70-
if (_browsingContextModule is null)
66+
if (_browsingContextModule is not null) return _browsingContextModule;
67+
lock (_moduleLock)
7168
{
72-
lock (_moduleLock)
73-
{
74-
if (_browsingContextModule is null)
75-
{
76-
_browsingContextModule = new BrowsingContext.BrowsingContextModule(_broker);
77-
}
78-
}
69+
_browsingContextModule ??= new BrowsingContext.BrowsingContextModule(_broker);
7970
}
8071
return _browsingContextModule;
8172
}
@@ -85,15 +76,10 @@ public Browser.BrowserModule Browser
8576
{
8677
get
8778
{
88-
if (_browserModule is null)
79+
if (_browserModule is not null) return _browserModule;
80+
lock (_moduleLock)
8981
{
90-
lock (_moduleLock)
91-
{
92-
if (_browserModule is null)
93-
{
94-
_browserModule = new Browser.BrowserModule(_broker);
95-
}
96-
}
82+
_browserModule ??= new Browser.BrowserModule(_broker);
9783
}
9884
return _browserModule;
9985
}
@@ -103,15 +89,10 @@ public Network.NetworkModule Network
10389
{
10490
get
10591
{
106-
if (_networkModule is null)
92+
if (_networkModule is not null) return _networkModule;
93+
lock (_moduleLock)
10794
{
108-
lock (_moduleLock)
109-
{
110-
if (_networkModule is null)
111-
{
112-
_networkModule = new Network.NetworkModule(_broker);
113-
}
114-
}
95+
_networkModule ??= new Network.NetworkModule(_broker);
11596
}
11697
return _networkModule;
11798
}
@@ -121,15 +102,10 @@ internal Input.InputModule InputModule
121102
{
122103
get
123104
{
124-
if (_inputModule is null)
105+
if (_inputModule is not null) return _inputModule;
106+
lock (_moduleLock)
125107
{
126-
lock (_moduleLock)
127-
{
128-
if (_inputModule is null)
129-
{
130-
_inputModule = new Input.InputModule(_broker);
131-
}
132-
}
108+
_inputModule ??= new Input.InputModule(_broker);
133109
}
134110
return _inputModule;
135111
}
@@ -139,15 +115,10 @@ public Script.ScriptModule Script
139115
{
140116
get
141117
{
142-
if (_scriptModule is null)
118+
if (_scriptModule is not null) return _scriptModule;
119+
lock (_moduleLock)
143120
{
144-
lock (_moduleLock)
145-
{
146-
if (_scriptModule is null)
147-
{
148-
_scriptModule = new Script.ScriptModule(_broker);
149-
}
150-
}
121+
_scriptModule ??= new Script.ScriptModule(_broker);
151122
}
152123
return _scriptModule;
153124
}
@@ -157,15 +128,10 @@ public Log.LogModule Log
157128
{
158129
get
159130
{
160-
if (_logModule is null)
131+
if (_logModule is not null) return _logModule;
132+
lock (_moduleLock)
161133
{
162-
lock (_moduleLock)
163-
{
164-
if (_logModule is null)
165-
{
166-
_logModule = new Log.LogModule(_broker);
167-
}
168-
}
134+
_logModule ??= new Log.LogModule(_broker);
169135
}
170136
return _logModule;
171137
}
@@ -175,15 +141,10 @@ public Storage.StorageModule Storage
175141
{
176142
get
177143
{
178-
if (_storageModule is null)
144+
if (_storageModule is not null) return _storageModule;
145+
lock (_moduleLock)
179146
{
180-
lock (_moduleLock)
181-
{
182-
if (_storageModule is null)
183-
{
184-
_storageModule = new Storage.StorageModule(_broker);
185-
}
186-
}
147+
_storageModule ??= new Storage.StorageModule(_broker);
187148
}
188149
return _storageModule;
189150
}
@@ -198,7 +159,7 @@ public static async Task<BiDi> ConnectAsync(string url)
198159
{
199160
var bidi = new BiDi(url);
200161

201-
await bidi._broker.ConnectAsync(default).ConfigureAwait(false);
162+
await bidi._broker.ConnectAsync(CancellationToken.None).ConfigureAwait(false);
202163

203164
return bidi;
204165
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// <copyright file="BiDiOptions.cs" company="Selenium Committers">
2+
// Licensed to the Software Freedom Conservancy (SFC) under one
3+
// or more contributor license agreements. See the NOTICE file
4+
// distributed with this work for additional information
5+
// regarding copyright ownership. The SFC licenses this file
6+
// to you under the Apache License, Version 2.0 (the
7+
// "License"); you may not use this file except in compliance
8+
// with the License. You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing,
13+
// software distributed under the License is distributed on an
14+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
// KIND, either express or implied. See the License for the
16+
// specific language governing permissions and limitations
17+
// under the License.
18+
// </copyright>
19+
20+
namespace OpenQA.Selenium.BiDi;
21+
22+
public sealed class BiDiOptions
23+
{
24+
}

dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContext.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,6 @@ public Task TraverseHistoryAsync(int delta, TraverseHistoryOptions? options = nu
9191
return BiDi.BrowsingContext.TraverseHistoryAsync(this, delta, options);
9292
}
9393

94-
public Task NavigateBackAsync(TraverseHistoryOptions? options = null)
95-
{
96-
return TraverseHistoryAsync(-1, options);
97-
}
98-
99-
public Task NavigateForwardAsync(TraverseHistoryOptions? options = null)
100-
{
101-
return TraverseHistoryAsync(1, options);
102-
}
103-
10494
public Task SetViewportAsync(SetViewportOptions? options = null)
10595
{
10696
return BiDi.BrowsingContext.SetViewportAsync(this, options);

dotnet/src/webdriver/BiDi/WebDriver.Extensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace OpenQA.Selenium.BiDi;
2424

2525
public static class WebDriverExtensions
2626
{
27-
public static async Task<BiDi> AsBiDiAsync(this IWebDriver webDriver)
27+
public static async Task<BiDi> AsBiDiAsync(this IWebDriver webDriver, BiDiOptions? options = null)
2828
{
2929
if (webDriver is null) throw new ArgumentNullException(nameof(webDriver));
3030

dotnet/src/webdriver/DriverService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ protected virtual void Dispose(bool disposing)
284284
/// Raises the <see cref="DriverProcessStarting"/> event.
285285
/// </summary>
286286
/// <param name="eventArgs">A <see cref="DriverProcessStartingEventArgs"/> that contains the event data.</param>
287-
protected void OnDriverProcessStarting(DriverProcessStartingEventArgs eventArgs)
287+
protected virtual void OnDriverProcessStarting(DriverProcessStartingEventArgs eventArgs)
288288
{
289289
if (eventArgs == null)
290290
{
@@ -298,7 +298,7 @@ protected void OnDriverProcessStarting(DriverProcessStartingEventArgs eventArgs)
298298
/// Raises the <see cref="DriverProcessStarted"/> event.
299299
/// </summary>
300300
/// <param name="eventArgs">A <see cref="DriverProcessStartedEventArgs"/> that contains the event data.</param>
301-
protected void OnDriverProcessStarted(DriverProcessStartedEventArgs eventArgs)
301+
protected virtual void OnDriverProcessStarted(DriverProcessStartedEventArgs eventArgs)
302302
{
303303
if (eventArgs == null)
304304
{

dotnet/src/webdriver/Firefox/FirefoxDriver.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public override IFileDetector FileDetector
252252
}
253253

254254
/// <summary>
255-
/// Sets the command context used when issuing commands to <c>geckodriver</c>.
255+
/// Gets the command context used when issuing commands to <c>geckodriver</c>.
256256
/// </summary>
257257
/// <exception cref="WebDriverException">If response is not recognized</exception>
258258
/// <returns>The context of commands.</returns>
@@ -263,7 +263,7 @@ public FirefoxCommandContext GetContext()
263263
if (commandResponse.Value is not string response
264264
|| !Enum.TryParse(response, ignoreCase: true, out FirefoxCommandContext output))
265265
{
266-
throw new WebDriverException(string.Format(CultureInfo.InvariantCulture, "Do not recognize response: {0}; expected Context or Chrome", commandResponse.Value));
266+
throw new WebDriverException(string.Format(CultureInfo.InvariantCulture, "Could not recognize the response: {0}; expected 'Content' or 'Chrome'", commandResponse.Value));
267267
}
268268

269269
return output;

0 commit comments

Comments
 (0)