Skip to content

Commit b448457

Browse files
authored
Merge branch 'SeleniumHQ:trunk' into py-selenium-manager-arm-support
2 parents 0a0967d + 148487d commit b448457

File tree

20 files changed

+473
-13
lines changed

20 files changed

+473
-13
lines changed

common/extensions/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ filegroup(
77
"**/*",
88
]),
99
visibility = [
10+
"//dotnet/test/common:__pkg__",
1011
"//java/test/org/openqa/selenium/chrome:__pkg__",
1112
"//java/test/org/openqa/selenium/edge:__pkg__",
1213
"//java/test/org/openqa/selenium/environment:__pkg__",

common/repositories.bzl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ js_library(
123123

124124
pkg_archive(
125125
name = "mac_edge",
126-
url = "https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/2c91478b-aace-43d7-8329-0bc57341712f/MicrosoftEdge-139.0.3405.86.pkg",
127-
sha256 = "07051b3d4c97eeeff72c0858ae9510a249d9b1193a9c0174bef4a9697dbd395d",
126+
url = "https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/4d599f34-3ef7-4f04-bd4b-6f35be25008c/MicrosoftEdge-139.0.3405.102.pkg",
127+
sha256 = "c5edb687ac110cabedf989706a6e9fade4f30375ef194f155fade830fc8837be",
128128
move = {
129-
"MicrosoftEdge-139.0.3405.86.pkg/Payload/Microsoft Edge.app": "Edge.app",
129+
"MicrosoftEdge-139.0.3405.102.pkg/Payload/Microsoft Edge.app": "Edge.app",
130130
},
131131
build_file_content = """
132132
load("@aspect_rules_js//js:defs.bzl", "js_library")
@@ -143,8 +143,8 @@ js_library(
143143

144144
deb_archive(
145145
name = "linux_edge",
146-
url = "https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/microsoft-edge-stable_139.0.3405.86-1_amd64.deb",
147-
sha256 = "4b5fd1512c1142c0509e8fc8df5c63c35086b34b49a65e4745ab5ab7ec0eaa61",
146+
url = "https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/microsoft-edge-stable_139.0.3405.102-1_amd64.deb",
147+
sha256 = "ad8e90dec3080065ff64a395bf04a5e9cc6adb8481d4f8829fb6f5a4c5cc7a9b",
148148
build_file_content = """
149149
load("@aspect_rules_js//js:defs.bzl", "js_library")
150150
package(default_visibility = ["//visibility:public"])
@@ -165,8 +165,8 @@ js_library(
165165

166166
http_archive(
167167
name = "linux_edgedriver",
168-
url = "https://msedgedriver.microsoft.com/139.0.3405.86/edgedriver_linux64.zip",
169-
sha256 = "49ce29de50f9ac418a3a2416708a5563215b8412b27d3e505f3c859fc6ffba12",
168+
url = "https://msedgedriver.microsoft.com/139.0.3405.102/edgedriver_linux64.zip",
169+
sha256 = "e092178901c011ccfddc0556193742a01f206d71b5bb1a12cc1ba7a243262fc2",
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.microsoft.com/139.0.3405.86/edgedriver_mac64.zip",
186-
sha256 = "b6c8244dfb7b8a223d3ac8fd569533f0a307eadaca2b8cbc884ce7f69294682e",
185+
url = "https://msedgedriver.microsoft.com/139.0.3405.102/edgedriver_mac64.zip",
186+
sha256 = "98aa637081061ea610c1f70be09fdea6b5f5b3a46c94a87ca291e2285bad1328",
187187
build_file_content = """
188188
load("@aspect_rules_js//js:defs.bzl", "js_library")
189189
package(default_visibility = ["//visibility:public"])

dotnet/src/webdriver/BiDi/BiDi.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public sealed class BiDi : IAsyncDisposable
3636
private Script.ScriptModule? _scriptModule;
3737
private Log.LogModule? _logModule;
3838
private Storage.StorageModule? _storageModule;
39+
private WebExtension.WebExtensionModule? _webExtensionModule;
3940

4041
private readonly object _moduleLock = new();
4142

@@ -150,12 +151,25 @@ public Storage.StorageModule Storage
150151
}
151152
}
152153

154+
public WebExtension.WebExtensionModule WebExtension
155+
{
156+
get
157+
{
158+
if (_webExtensionModule is not null) return _webExtensionModule;
159+
lock (_moduleLock)
160+
{
161+
_webExtensionModule ??= new WebExtension.WebExtensionModule(_broker);
162+
}
163+
return _webExtensionModule;
164+
}
165+
}
166+
153167
public Task<Session.StatusResult> StatusAsync()
154168
{
155169
return SessionModule.StatusAsync();
156170
}
157171

158-
public static async Task<BiDi> ConnectAsync(string url)
172+
public static async Task<BiDi> ConnectAsync(string url, BiDiOptions? options = null)
159173
{
160174
var bidi = new BiDi(url);
161175

dotnet/src/webdriver/BiDi/Communication/Broker.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ internal Broker(BiDi bidi, Uri url)
8686
new DateTimeOffsetConverter(),
8787
new PrintPageRangeConverter(),
8888
new InputOriginConverter(),
89+
new WebExtensionConverter(_bidi),
8990
new SubscriptionConverter(),
9091
new JsonStringEnumConverter(JsonNamingPolicy.CamelCase),
9192

dotnet/src/webdriver/BiDi/Communication/Json/BiDiJsonSerializerContext.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,4 +165,8 @@ namespace OpenQA.Selenium.BiDi.Communication.Json;
165165
[JsonSerializable(typeof(IEnumerable<Input.INoneSourceAction>))]
166166
[JsonSerializable(typeof(IEnumerable<Input.IWheelSourceAction>))]
167167

168+
[JsonSerializable(typeof(WebExtension.InstallCommand))]
169+
[JsonSerializable(typeof(WebExtension.InstallResult))]
170+
[JsonSerializable(typeof(WebExtension.UninstallCommand))]
171+
168172
internal partial class BiDiJsonSerializerContext : JsonSerializerContext;
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// <copyright file="WebExtensionConverter.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+
using OpenQA.Selenium.BiDi.WebExtension;
21+
using System;
22+
using System.Text.Json;
23+
using System.Text.Json.Serialization;
24+
25+
namespace OpenQA.Selenium.BiDi.Communication.Json.Converters;
26+
27+
internal class WebExtensionConverter : JsonConverter<Extension>
28+
{
29+
private readonly BiDi _bidi;
30+
31+
public WebExtensionConverter(BiDi bidi)
32+
{
33+
_bidi = bidi;
34+
}
35+
36+
public override Extension? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
37+
{
38+
var id = reader.GetString();
39+
40+
return new Extension(_bidi, id!);
41+
}
42+
43+
public override void Write(Utf8JsonWriter writer, Extension value, JsonSerializerOptions options)
44+
{
45+
writer.WriteStringValue(value.Id);
46+
}
47+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public static async Task<BiDi> AsBiDiAsync(this IWebDriver webDriver, BiDiOption
3737

3838
if (webSocketUrl is null) throw new BiDiException("The driver is not compatible with bidirectional protocol or \"webSocketUrl\" not enabled in driver options.");
3939

40-
var bidi = await BiDi.ConnectAsync(webSocketUrl).ConfigureAwait(false);
40+
var bidi = await BiDi.ConnectAsync(webSocketUrl, options).ConfigureAwait(false);
4141

4242
return bidi;
4343
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// <copyright file="Extension.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+
using System.Threading.Tasks;
21+
22+
namespace OpenQA.Selenium.BiDi.WebExtension;
23+
24+
public sealed class Extension
25+
{
26+
private readonly BiDi _bidi;
27+
28+
public Extension(BiDi bidi, string id)
29+
{
30+
_bidi = bidi;
31+
Id = id;
32+
}
33+
34+
internal string Id { get; }
35+
36+
public Task UninstallAsync(UninstallOptions? options = null)
37+
{
38+
return _bidi.WebExtension.UninstallAsync(this, options);
39+
}
40+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// <copyright file="InstallCommand.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+
using OpenQA.Selenium.BiDi.Communication;
21+
using System.Text.Json.Serialization;
22+
23+
namespace OpenQA.Selenium.BiDi.WebExtension;
24+
25+
internal sealed class InstallCommand(InstallParameters @params)
26+
: Command<InstallParameters, InstallResult>(@params, "webExtension.install");
27+
28+
internal sealed record InstallParameters(ExtensionData ExtensionData) : Parameters;
29+
30+
[JsonPolymorphic(TypeDiscriminatorPropertyName = "type")]
31+
[JsonDerivedType(typeof(ExtensionArchivePath), "archivePath")]
32+
[JsonDerivedType(typeof(ExtensionBase64Encoded), "base64")]
33+
[JsonDerivedType(typeof(ExtensionPath), "path")]
34+
public abstract record ExtensionData;
35+
36+
public sealed record ExtensionArchivePath(string Path) : ExtensionData;
37+
38+
public sealed record ExtensionBase64Encoded(string Value) : ExtensionData;
39+
40+
public sealed record ExtensionPath(string Path) : ExtensionData;
41+
42+
public sealed class InstallOptions : CommandOptions;
43+
44+
public sealed record InstallResult(Extension Extension) : EmptyResult;
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// <copyright file="UninstallCommand.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+
using OpenQA.Selenium.BiDi.Communication;
21+
22+
namespace OpenQA.Selenium.BiDi.WebExtension;
23+
24+
internal sealed class UninstallCommand(UninstallParameters @params)
25+
: Command<UninstallParameters, EmptyResult>(@params, "webExtension.uninstall");
26+
27+
internal sealed record UninstallParameters(Extension Extension) : Parameters;
28+
29+
public sealed class UninstallOptions : CommandOptions;

0 commit comments

Comments
 (0)