From 518cf73756ba219b14ea584d0b45bcb461512e3a Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 21 Feb 2026 12:39:22 +0300 Subject: [PATCH 1/4] BrowsingContextEventArgs --- .../BrowsingContextEventArgs.cs | 23 +++++++++++++++++++ .../BrowsingContext/BrowsingContextInfo.cs | 3 +-- .../BrowsingContext/BrowsingContextModule.cs | 18 +++++++-------- 3 files changed, 33 insertions(+), 11 deletions(-) create mode 100644 dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextEventArgs.cs diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextEventArgs.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextEventArgs.cs new file mode 100644 index 0000000000000..3aadd108cd52e --- /dev/null +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextEventArgs.cs @@ -0,0 +1,23 @@ +// +// Licensed to the Software Freedom Conservancy (SFC) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The SFC licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// + +namespace OpenQA.Selenium.BiDi.BrowsingContext; + +public sealed record BrowsingContextEventArgs(IReadOnlyList? Children, Browser.ClientWindow ClientWindow, BrowsingContext Context, BrowsingContext? OriginalOpener, string Url, Browser.UserContext UserContext, BrowsingContext? Parent) + : EventArgs; diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextInfo.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextInfo.cs index 90c3e0c750ee4..1742af0c337fe 100644 --- a/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextInfo.cs +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextInfo.cs @@ -19,5 +19,4 @@ namespace OpenQA.Selenium.BiDi.BrowsingContext; -public sealed record BrowsingContextInfo(IReadOnlyList? Children, Browser.ClientWindow ClientWindow, BrowsingContext Context, BrowsingContext? OriginalOpener, string Url, Browser.UserContext UserContext, BrowsingContext? Parent) - : EventArgs; +public sealed record BrowsingContextInfo(IReadOnlyList? Children, Browser.ClientWindow ClientWindow, BrowsingContext Context, BrowsingContext? OriginalOpener, string Url, Browser.UserContext UserContext, BrowsingContext? Parent); diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextModule.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextModule.cs index 5a912c0b93a75..d005427236614 100644 --- a/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextModule.cs +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextModule.cs @@ -211,24 +211,24 @@ public async Task OnNavigationCommittedAsync(Action OnContextCreatedAsync(Func handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) + public async Task OnContextCreatedAsync(Func handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) { - return await SubscribeAsync("browsingContext.contextCreated", handler, options, _jsonContext.BrowsingContextInfo, cancellationToken).ConfigureAwait(false); + return await SubscribeAsync("browsingContext.contextCreated", handler, options, _jsonContext.BrowsingContextEventArgs, cancellationToken).ConfigureAwait(false); } - public async Task OnContextCreatedAsync(Action handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) + public async Task OnContextCreatedAsync(Action handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) { - return await SubscribeAsync("browsingContext.contextCreated", handler, options, _jsonContext.BrowsingContextInfo, cancellationToken).ConfigureAwait(false); + return await SubscribeAsync("browsingContext.contextCreated", handler, options, _jsonContext.BrowsingContextEventArgs, cancellationToken).ConfigureAwait(false); } - public async Task OnContextDestroyedAsync(Func handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) + public async Task OnContextDestroyedAsync(Func handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) { - return await SubscribeAsync("browsingContext.contextDestroyed", handler, options, _jsonContext.BrowsingContextInfo, cancellationToken).ConfigureAwait(false); + return await SubscribeAsync("browsingContext.contextDestroyed", handler, options, _jsonContext.BrowsingContextEventArgs, cancellationToken).ConfigureAwait(false); } - public async Task OnContextDestroyedAsync(Action handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) + public async Task OnContextDestroyedAsync(Action handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) { - return await SubscribeAsync("browsingContext.contextDestroyed", handler, options, _jsonContext.BrowsingContextInfo, cancellationToken).ConfigureAwait(false); + return await SubscribeAsync("browsingContext.contextDestroyed", handler, options, _jsonContext.BrowsingContextEventArgs, cancellationToken).ConfigureAwait(false); } public async Task OnUserPromptOpenedAsync(Func handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) @@ -287,7 +287,7 @@ protected override void Initialize(BiDi bidi, JsonSerializerOptions jsonSerializ [JsonSerializable(typeof(TraverseHistoryCommand))] [JsonSerializable(typeof(TraverseHistoryResult))] -[JsonSerializable(typeof(BrowsingContextInfo))] +[JsonSerializable(typeof(BrowsingContextEventArgs))] [JsonSerializable(typeof(DownloadWillBeginEventArgs))] [JsonSerializable(typeof(DownloadEndEventArgs))] [JsonSerializable(typeof(DownloadCanceledEventArgs))] From ae601bb008b9223ce821fa94f4406b5dc9113526 Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 21 Feb 2026 12:52:31 +0300 Subject: [PATCH 2/4] NavigationEventArgs --- .../BiDi/BrowsingContext/BrowsingContext.cs | 56 +++++++++--------- .../BrowsingContext/BrowsingContextModule.cs | 58 +++++++++---------- .../BrowsingContext/NavigationEventArgs.cs | 23 ++++++++ .../BiDi/BrowsingContext/NavigationInfo.cs | 2 +- 4 files changed, 81 insertions(+), 58 deletions(-) create mode 100644 dotnet/src/webdriver/BiDi/BrowsingContext/NavigationEventArgs.cs diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContext.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContext.cs index c87285fb0a946..22b049f24853f 100644 --- a/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContext.cs +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContext.cs @@ -123,7 +123,7 @@ public Task GetTreeAsync(ContextGetTreeOptions? options = null, C return BiDi.BrowsingContext.GetTreeAsync(ContextGetTreeOptions.WithContext(options, this), cancellationToken); } - public Task OnNavigationStartedAsync(Func handler, ContextSubscriptionOptions? options = null) + public Task OnNavigationStartedAsync(Func handler, ContextSubscriptionOptions? options = null) { if (handler is null) throw new ArgumentNullException(nameof(handler)); @@ -132,7 +132,7 @@ public Task OnNavigationStartedAsync(Func ha ContextSubscriptionOptions.WithContext(options, this)); } - public Task OnNavigationStartedAsync(Action handler, ContextSubscriptionOptions? options = null) + public Task OnNavigationStartedAsync(Action handler, ContextSubscriptionOptions? options = null) { if (handler is null) throw new ArgumentNullException(nameof(handler)); @@ -141,7 +141,7 @@ public Task OnNavigationStartedAsync(Action handle ContextSubscriptionOptions.WithContext(options, this)); } - public Task OnFragmentNavigatedAsync(Func handler, ContextSubscriptionOptions? options = null) + public Task OnFragmentNavigatedAsync(Func handler, ContextSubscriptionOptions? options = null) { if (handler is null) throw new ArgumentNullException(nameof(handler)); @@ -150,7 +150,7 @@ public Task OnFragmentNavigatedAsync(Func ha ContextSubscriptionOptions.WithContext(options, this)); } - public Task OnFragmentNavigatedAsync(Action handler, ContextSubscriptionOptions? options = null) + public Task OnFragmentNavigatedAsync(Action handler, ContextSubscriptionOptions? options = null) { if (handler is null) throw new ArgumentNullException(nameof(handler)); @@ -177,7 +177,7 @@ public Task OnHistoryUpdatedAsync(Action ContextSubscriptionOptions.WithContext(options, this)); } - public Task OnDomContentLoadedAsync(Func handler, ContextSubscriptionOptions? options = null) + public Task OnDomContentLoadedAsync(Func handler, ContextSubscriptionOptions? options = null) { if (handler is null) throw new ArgumentNullException(nameof(handler)); @@ -186,7 +186,7 @@ public Task OnDomContentLoadedAsync(Func han ContextSubscriptionOptions.WithContext(options, this)); } - public Task OnDomContentLoadedAsync(Action handler, ContextSubscriptionOptions? options = null) + public Task OnDomContentLoadedAsync(Action handler, ContextSubscriptionOptions? options = null) { if (handler is null) throw new ArgumentNullException(nameof(handler)); @@ -195,7 +195,7 @@ public Task OnDomContentLoadedAsync(Action handler ContextSubscriptionOptions.WithContext(options, this)); } - public Task OnLoadAsync(Action handler, ContextSubscriptionOptions? options = null) + public Task OnLoadAsync(Action handler, ContextSubscriptionOptions? options = null) { if (handler is null) throw new ArgumentNullException(nameof(handler)); @@ -204,7 +204,7 @@ public Task OnLoadAsync(Action handler, ContextSub ContextSubscriptionOptions.WithContext(options, this)); } - public Task OnLoadAsync(Func handler, ContextSubscriptionOptions? options = null) + public Task OnLoadAsync(Func handler, ContextSubscriptionOptions? options = null) { if (handler is null) throw new ArgumentNullException(nameof(handler)); @@ -249,7 +249,7 @@ public Task OnDownloadEndAsync(Func ha ContextSubscriptionOptions.WithContext(options, this)); } - public Task OnNavigationAbortedAsync(Action handler, ContextSubscriptionOptions? options = null) + public Task OnNavigationAbortedAsync(Action handler, ContextSubscriptionOptions? options = null) { if (handler is null) throw new ArgumentNullException(nameof(handler)); @@ -258,7 +258,7 @@ public Task OnNavigationAbortedAsync(Action handle ContextSubscriptionOptions.WithContext(options, this)); } - public Task OnNavigationAbortedAsync(Func handler, ContextSubscriptionOptions? options = null) + public Task OnNavigationAbortedAsync(Func handler, ContextSubscriptionOptions? options = null) { if (handler is null) throw new ArgumentNullException(nameof(handler)); @@ -267,7 +267,7 @@ public Task OnNavigationAbortedAsync(Func ha ContextSubscriptionOptions.WithContext(options, this)); } - public Task OnNavigationFailedAsync(Action handler, ContextSubscriptionOptions? options = null) + public Task OnNavigationFailedAsync(Action handler, ContextSubscriptionOptions? options = null) { if (handler is null) throw new ArgumentNullException(nameof(handler)); @@ -276,7 +276,7 @@ public Task OnNavigationFailedAsync(Action handler ContextSubscriptionOptions.WithContext(options, this)); } - public Task OnNavigationFailedAsync(Func handler, ContextSubscriptionOptions? options = null) + public Task OnNavigationFailedAsync(Func handler, ContextSubscriptionOptions? options = null) { if (handler is null) throw new ArgumentNullException(nameof(handler)); @@ -285,7 +285,7 @@ public Task OnNavigationFailedAsync(Func han ContextSubscriptionOptions.WithContext(options, this)); } - public Task OnNavigationCommittedAsync(Action handler, ContextSubscriptionOptions? options = null) + public Task OnNavigationCommittedAsync(Action handler, ContextSubscriptionOptions? options = null) { if (handler is null) throw new ArgumentNullException(nameof(handler)); @@ -294,7 +294,7 @@ public Task OnNavigationCommittedAsync(Action hand ContextSubscriptionOptions.WithContext(options, this)); } - public Task OnNavigationCommittedAsync(Func handler, ContextSubscriptionOptions? options = null) + public Task OnNavigationCommittedAsync(Func handler, ContextSubscriptionOptions? options = null) { if (handler is null) throw new ArgumentNullException(nameof(handler)); @@ -303,7 +303,7 @@ public Task OnNavigationCommittedAsync(Func ContextSubscriptionOptions.WithContext(options, this)); } - private async Task HandleNavigationStartedAsync(NavigationInfo e, Func handler) + private async Task HandleNavigationStartedAsync(NavigationEventArgs e, Func handler) { if (Equals(e.Context)) { @@ -311,7 +311,7 @@ private async Task HandleNavigationStartedAsync(NavigationInfo e, Func handler) + private void HandleNavigationStarted(NavigationEventArgs e, Action handler) { if (Equals(e.Context)) { @@ -319,7 +319,7 @@ private void HandleNavigationStarted(NavigationInfo e, Action ha } } - private async Task HandleFragmentNavigatedAsync(NavigationInfo e, Func handler) + private async Task HandleFragmentNavigatedAsync(NavigationEventArgs e, Func handler) { if (Equals(e.Context)) { @@ -327,7 +327,7 @@ private async Task HandleFragmentNavigatedAsync(NavigationInfo e, Func handler) + private void HandleFragmentNavigated(NavigationEventArgs e, Action handler) { if (Equals(e.Context)) { @@ -351,7 +351,7 @@ private void HandleHistoryUpdated(HistoryUpdatedEventArgs e, Action handler) + private async Task HandleDomContentLoadedAsync(NavigationEventArgs e, Func handler) { if (Equals(e.Context)) { @@ -359,7 +359,7 @@ private async Task HandleDomContentLoadedAsync(NavigationInfo e, Func handler) + private void HandleDomContentLoaded(NavigationEventArgs e, Action handler) { if (Equals(e.Context)) { @@ -367,7 +367,7 @@ private void HandleDomContentLoaded(NavigationInfo e, Action han } } - private void HandleLoad(NavigationInfo e, Action handler) + private void HandleLoad(NavigationEventArgs e, Action handler) { if (Equals(e.Context)) { @@ -375,7 +375,7 @@ private void HandleLoad(NavigationInfo e, Action handler) } } - private async Task HandleLoadAsync(NavigationInfo e, Func handler) + private async Task HandleLoadAsync(NavigationEventArgs e, Func handler) { if (Equals(e.Context)) { @@ -415,7 +415,7 @@ private async Task HandleDownloadEndAsync(DownloadEndEventArgs e, Func handler) + private void HandleNavigationAborted(NavigationEventArgs e, Action handler) { if (Equals(e.Context)) { @@ -423,7 +423,7 @@ private void HandleNavigationAborted(NavigationInfo e, Action ha } } - private async Task HandleNavigationAbortedAsync(NavigationInfo e, Func handler) + private async Task HandleNavigationAbortedAsync(NavigationEventArgs e, Func handler) { if (Equals(e.Context)) { @@ -431,7 +431,7 @@ private async Task HandleNavigationAbortedAsync(NavigationInfo e, Func handler) + private void HandleNavigationFailed(NavigationEventArgs e, Action handler) { if (Equals(e.Context)) { @@ -439,7 +439,7 @@ private void HandleNavigationFailed(NavigationInfo e, Action han } } - private async Task HandleNavigationFailedAsync(NavigationInfo e, Func handler) + private async Task HandleNavigationFailedAsync(NavigationEventArgs e, Func handler) { if (Equals(e.Context)) { @@ -447,7 +447,7 @@ private async Task HandleNavigationFailedAsync(NavigationInfo e, Func handler) + private void HandleNavigationCommitted(NavigationEventArgs e, Action handler) { if (Equals(e.Context)) { @@ -455,7 +455,7 @@ private void HandleNavigationCommitted(NavigationInfo e, Action } } - private async Task HandleNavigationCommittedAsync(NavigationInfo e, Func handler) + private async Task HandleNavigationCommittedAsync(NavigationEventArgs e, Func handler) { if (Equals(e.Context)) { diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextModule.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextModule.cs index d005427236614..a7119bd9df2f5 100644 --- a/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextModule.cs +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextModule.cs @@ -111,24 +111,24 @@ public async Task HandleUserPromptAsync(BrowsingContext return await ExecuteCommandAsync(new HandleUserPromptCommand(@params), options, _jsonContext.HandleUserPromptCommand, _jsonContext.HandleUserPromptResult, cancellationToken).ConfigureAwait(false); } - public async Task OnNavigationStartedAsync(Func handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) + public async Task OnNavigationStartedAsync(Func handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) { - return await SubscribeAsync("browsingContext.navigationStarted", handler, options, _jsonContext.NavigationInfo, cancellationToken).ConfigureAwait(false); + return await SubscribeAsync("browsingContext.navigationStarted", handler, options, _jsonContext.NavigationEventArgs, cancellationToken).ConfigureAwait(false); } - public async Task OnNavigationStartedAsync(Action handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) + public async Task OnNavigationStartedAsync(Action handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) { - return await SubscribeAsync("browsingContext.navigationStarted", handler, options, _jsonContext.NavigationInfo, cancellationToken).ConfigureAwait(false); + return await SubscribeAsync("browsingContext.navigationStarted", handler, options, _jsonContext.NavigationEventArgs, cancellationToken).ConfigureAwait(false); } - public async Task OnFragmentNavigatedAsync(Func handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) + public async Task OnFragmentNavigatedAsync(Func handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) { - return await SubscribeAsync("browsingContext.fragmentNavigated", handler, options, _jsonContext.NavigationInfo, cancellationToken).ConfigureAwait(false); + return await SubscribeAsync("browsingContext.fragmentNavigated", handler, options, _jsonContext.NavigationEventArgs, cancellationToken).ConfigureAwait(false); } - public async Task OnFragmentNavigatedAsync(Action handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) + public async Task OnFragmentNavigatedAsync(Action handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) { - return await SubscribeAsync("browsingContext.fragmentNavigated", handler, options, _jsonContext.NavigationInfo, cancellationToken).ConfigureAwait(false); + return await SubscribeAsync("browsingContext.fragmentNavigated", handler, options, _jsonContext.NavigationEventArgs, cancellationToken).ConfigureAwait(false); } public async Task OnHistoryUpdatedAsync(Func handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) @@ -141,24 +141,24 @@ public async Task OnHistoryUpdatedAsync(Action OnDomContentLoadedAsync(Func handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) + public async Task OnDomContentLoadedAsync(Func handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) { - return await SubscribeAsync("browsingContext.domContentLoaded", handler, options, _jsonContext.NavigationInfo, cancellationToken).ConfigureAwait(false); + return await SubscribeAsync("browsingContext.domContentLoaded", handler, options, _jsonContext.NavigationEventArgs, cancellationToken).ConfigureAwait(false); } - public async Task OnDomContentLoadedAsync(Action handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) + public async Task OnDomContentLoadedAsync(Action handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) { - return await SubscribeAsync("browsingContext.domContentLoaded", handler, options, _jsonContext.NavigationInfo, cancellationToken).ConfigureAwait(false); + return await SubscribeAsync("browsingContext.domContentLoaded", handler, options, _jsonContext.NavigationEventArgs, cancellationToken).ConfigureAwait(false); } - public async Task OnLoadAsync(Func handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) + public async Task OnLoadAsync(Func handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) { - return await SubscribeAsync("browsingContext.load", handler, options, _jsonContext.NavigationInfo, cancellationToken).ConfigureAwait(false); + return await SubscribeAsync("browsingContext.load", handler, options, _jsonContext.NavigationEventArgs, cancellationToken).ConfigureAwait(false); } - public async Task OnLoadAsync(Action handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) + public async Task OnLoadAsync(Action handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) { - return await SubscribeAsync("browsingContext.load", handler, options, _jsonContext.NavigationInfo, cancellationToken).ConfigureAwait(false); + return await SubscribeAsync("browsingContext.load", handler, options, _jsonContext.NavigationEventArgs, cancellationToken).ConfigureAwait(false); } public async Task OnDownloadWillBeginAsync(Func handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) @@ -181,34 +181,34 @@ public async Task OnDownloadEndAsync(Action return await SubscribeAsync("browsingContext.downloadEnd", handler, options, _jsonContext.DownloadEndEventArgs, cancellationToken).ConfigureAwait(false); } - public async Task OnNavigationAbortedAsync(Func handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) + public async Task OnNavigationAbortedAsync(Func handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) { - return await SubscribeAsync("browsingContext.navigationAborted", handler, options, _jsonContext.NavigationInfo, cancellationToken).ConfigureAwait(false); + return await SubscribeAsync("browsingContext.navigationAborted", handler, options, _jsonContext.NavigationEventArgs, cancellationToken).ConfigureAwait(false); } - public async Task OnNavigationAbortedAsync(Action handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) + public async Task OnNavigationAbortedAsync(Action handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) { - return await SubscribeAsync("browsingContext.navigationAborted", handler, options, _jsonContext.NavigationInfo, cancellationToken).ConfigureAwait(false); + return await SubscribeAsync("browsingContext.navigationAborted", handler, options, _jsonContext.NavigationEventArgs, cancellationToken).ConfigureAwait(false); } - public async Task OnNavigationFailedAsync(Func handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) + public async Task OnNavigationFailedAsync(Func handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) { - return await SubscribeAsync("browsingContext.navigationFailed", handler, options, _jsonContext.NavigationInfo, cancellationToken).ConfigureAwait(false); + return await SubscribeAsync("browsingContext.navigationFailed", handler, options, _jsonContext.NavigationEventArgs, cancellationToken).ConfigureAwait(false); } - public async Task OnNavigationFailedAsync(Action handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) + public async Task OnNavigationFailedAsync(Action handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) { - return await SubscribeAsync("browsingContext.navigationFailed", handler, options, _jsonContext.NavigationInfo, cancellationToken).ConfigureAwait(false); + return await SubscribeAsync("browsingContext.navigationFailed", handler, options, _jsonContext.NavigationEventArgs, cancellationToken).ConfigureAwait(false); } - public async Task OnNavigationCommittedAsync(Func handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) + public async Task OnNavigationCommittedAsync(Func handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) { - return await SubscribeAsync("browsingContext.navigationCommitted", handler, options, _jsonContext.NavigationInfo, cancellationToken).ConfigureAwait(false); + return await SubscribeAsync("browsingContext.navigationCommitted", handler, options, _jsonContext.NavigationEventArgs, cancellationToken).ConfigureAwait(false); } - public async Task OnNavigationCommittedAsync(Action handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) + public async Task OnNavigationCommittedAsync(Action handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) { - return await SubscribeAsync("browsingContext.navigationCommitted", handler, options, _jsonContext.NavigationInfo, cancellationToken).ConfigureAwait(false); + return await SubscribeAsync("browsingContext.navigationCommitted", handler, options, _jsonContext.NavigationEventArgs, cancellationToken).ConfigureAwait(false); } public async Task OnContextCreatedAsync(Func handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) @@ -293,7 +293,7 @@ protected override void Initialize(BiDi bidi, JsonSerializerOptions jsonSerializ [JsonSerializable(typeof(DownloadCanceledEventArgs))] [JsonSerializable(typeof(DownloadCompleteEventArgs))] [JsonSerializable(typeof(HistoryUpdatedEventArgs))] -[JsonSerializable(typeof(NavigationInfo))] +[JsonSerializable(typeof(NavigationEventArgs))] [JsonSerializable(typeof(UserPromptOpenedEventArgs))] [JsonSerializable(typeof(UserPromptClosedEventArgs))] diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/NavigationEventArgs.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/NavigationEventArgs.cs new file mode 100644 index 0000000000000..c7e0570c93a78 --- /dev/null +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/NavigationEventArgs.cs @@ -0,0 +1,23 @@ +// +// Licensed to the Software Freedom Conservancy (SFC) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The SFC licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// + +namespace OpenQA.Selenium.BiDi.BrowsingContext; + +public sealed record NavigationEventArgs(BrowsingContext Context, Navigation? Navigation, DateTimeOffset Timestamp, string Url, Browser.UserContext? UserContext) + : EventArgs, IBaseNavigationInfo; diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/NavigationInfo.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/NavigationInfo.cs index e71865d90bf6b..ffc58577a6cd9 100644 --- a/dotnet/src/webdriver/BiDi/BrowsingContext/NavigationInfo.cs +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/NavigationInfo.cs @@ -20,4 +20,4 @@ namespace OpenQA.Selenium.BiDi.BrowsingContext; public sealed record NavigationInfo(BrowsingContext Context, Navigation? Navigation, DateTimeOffset Timestamp, string Url, Browser.UserContext? UserContext) - : EventArgs, IBaseNavigationInfo; + : IBaseNavigationInfo; From 6fff90b483672e30c4c3f98bb94befc26ad74b23 Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 21 Feb 2026 12:55:32 +0300 Subject: [PATCH 3/4] FileDialogEventArgs --- .../BiDi/BrowsingContext/BrowsingContextInputModule.cs | 8 ++++---- .../{FileDialogInfo.cs => FileDialogEventArgs.cs} | 4 ++-- dotnet/src/webdriver/BiDi/Input/InputModule.cs | 10 +++++----- dotnet/test/common/BiDi/Input/InputEventsTests.cs | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) rename dotnet/src/webdriver/BiDi/Input/{FileDialogInfo.cs => FileDialogEventArgs.cs} (78%) diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextInputModule.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextInputModule.cs index 869ab06c93173..0b7b9b526177a 100644 --- a/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextInputModule.cs +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextInputModule.cs @@ -38,7 +38,7 @@ public Task SetFilesAsync(Script.ISharedReference element, IEnum return inputModule.SetFilesAsync(context, element, files, options, cancellationToken); } - public Task OnFileDialogOpenedAsync(Func handler, ContextSubscriptionOptions? options = null, CancellationToken cancellationToken = default) + public Task OnFileDialogOpenedAsync(Func handler, ContextSubscriptionOptions? options = null, CancellationToken cancellationToken = default) { if (handler is null) throw new ArgumentNullException(nameof(handler)); @@ -48,7 +48,7 @@ public Task OnFileDialogOpenedAsync(Func han cancellationToken); } - public Task OnFileDialogOpenedAsync(Action handler, ContextSubscriptionOptions? options = null, CancellationToken cancellationToken = default) + public Task OnFileDialogOpenedAsync(Action handler, ContextSubscriptionOptions? options = null, CancellationToken cancellationToken = default) { if (handler is null) throw new ArgumentNullException(nameof(handler)); @@ -58,7 +58,7 @@ public Task OnFileDialogOpenedAsync(Action handler cancellationToken); } - private async Task HandleFileDialogOpenedAsync(FileDialogInfo e, Func handler) + private async Task HandleFileDialogOpenedAsync(FileDialogEventArgs e, Func handler) { if (context.Equals(e.Context)) { @@ -66,7 +66,7 @@ private async Task HandleFileDialogOpenedAsync(FileDialogInfo e, Func handler) + private void HandleFileDialogOpened(FileDialogEventArgs e, Action handler) { if (context.Equals(e.Context)) { diff --git a/dotnet/src/webdriver/BiDi/Input/FileDialogInfo.cs b/dotnet/src/webdriver/BiDi/Input/FileDialogEventArgs.cs similarity index 78% rename from dotnet/src/webdriver/BiDi/Input/FileDialogInfo.cs rename to dotnet/src/webdriver/BiDi/Input/FileDialogEventArgs.cs index c95693f83a64e..b048251b54e8b 100644 --- a/dotnet/src/webdriver/BiDi/Input/FileDialogInfo.cs +++ b/dotnet/src/webdriver/BiDi/Input/FileDialogEventArgs.cs @@ -1,4 +1,4 @@ -// +// // Licensed to the Software Freedom Conservancy (SFC) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information @@ -19,5 +19,5 @@ namespace OpenQA.Selenium.BiDi.Input; -public sealed record FileDialogInfo(BrowsingContext.BrowsingContext Context, Browser.UserContext? UserContext, bool Multiple, Script.SharedReference? Element) +public sealed record FileDialogEventArgs(BrowsingContext.BrowsingContext Context, Browser.UserContext? UserContext, bool Multiple, Script.SharedReference? Element) : EventArgs; diff --git a/dotnet/src/webdriver/BiDi/Input/InputModule.cs b/dotnet/src/webdriver/BiDi/Input/InputModule.cs index dd3cd4570691b..e31287532c6ec 100644 --- a/dotnet/src/webdriver/BiDi/Input/InputModule.cs +++ b/dotnet/src/webdriver/BiDi/Input/InputModule.cs @@ -48,14 +48,14 @@ public async Task SetFilesAsync(BrowsingContext.BrowsingContext return await ExecuteCommandAsync(new SetFilesCommand(@params), options, _jsonContext.SetFilesCommand, _jsonContext.SetFilesResult, cancellationToken).ConfigureAwait(false); } - public async Task OnFileDialogOpenedAsync(Func handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) + public async Task OnFileDialogOpenedAsync(Func handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) { - return await SubscribeAsync("input.fileDialogOpened", handler, options, _jsonContext.FileDialogInfo, cancellationToken).ConfigureAwait(false); + return await SubscribeAsync("input.fileDialogOpened", handler, options, _jsonContext.FileDialogEventArgs, cancellationToken).ConfigureAwait(false); } - public async Task OnFileDialogOpenedAsync(Action handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) + public async Task OnFileDialogOpenedAsync(Action handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) { - return await SubscribeAsync("input.fileDialogOpened", handler, options, _jsonContext.FileDialogInfo, cancellationToken).ConfigureAwait(false); + return await SubscribeAsync("input.fileDialogOpened", handler, options, _jsonContext.FileDialogEventArgs, cancellationToken).ConfigureAwait(false); } protected override void Initialize(BiDi bidi, JsonSerializerOptions jsonSerializerOptions) @@ -74,7 +74,7 @@ protected override void Initialize(BiDi bidi, JsonSerializerOptions jsonSerializ [JsonSerializable(typeof(ReleaseActionsResult))] [JsonSerializable(typeof(SetFilesCommand))] [JsonSerializable(typeof(SetFilesResult))] -[JsonSerializable(typeof(FileDialogInfo))] +[JsonSerializable(typeof(FileDialogEventArgs))] [JsonSerializable(typeof(IEnumerable))] [JsonSerializable(typeof(IEnumerable))] [JsonSerializable(typeof(IEnumerable))] diff --git a/dotnet/test/common/BiDi/Input/InputEventsTests.cs b/dotnet/test/common/BiDi/Input/InputEventsTests.cs index a0e4ffcfb0c2e..255d37f4e7655 100644 --- a/dotnet/test/common/BiDi/Input/InputEventsTests.cs +++ b/dotnet/test/common/BiDi/Input/InputEventsTests.cs @@ -29,7 +29,7 @@ internal class InputEventsTests : BiDiTestFixture [Test] public async Task CanListenToFileDialogOpenedEvent() { - TaskCompletionSource tcs = new(); + TaskCompletionSource tcs = new(); await using var subscription = await context.Input.OnFileDialogOpenedAsync(tcs.SetResult); From 5562ac4c5e3d420d914bae06b0f82d33301bf104 Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sat, 21 Feb 2026 13:05:19 +0300 Subject: [PATCH 4/4] LogEntryEventArgs --- .../BrowsingContextLogModule.cs | 8 +++---- ...erter.cs => LogEntryEventArgsConverter.cs} | 14 +++++------ .../Log/{LogEntry.cs => LogEntryEventArgs.cs} | 24 +++++++++---------- dotnet/src/webdriver/BiDi/Log/LogModule.cs | 18 +++++++------- dotnet/test/common/BiDi/Log/LogTests.cs | 12 +++++----- .../common/BiDi/Script/ScriptCommandsTests.cs | 2 +- 6 files changed, 39 insertions(+), 39 deletions(-) rename dotnet/src/webdriver/BiDi/Json/Converters/Polymorphic/{LogEntryConverter.cs => LogEntryEventArgsConverter.cs} (71%) rename dotnet/src/webdriver/BiDi/Log/{LogEntry.cs => LogEntryEventArgs.cs} (55%) diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextLogModule.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextLogModule.cs index 617f854a2ee68..e9adafc1a374b 100644 --- a/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextLogModule.cs +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextLogModule.cs @@ -23,7 +23,7 @@ namespace OpenQA.Selenium.BiDi.BrowsingContext; public sealed class BrowsingContextLogModule(BrowsingContext context, LogModule logModule) { - public Task OnEntryAddedAsync(Func handler, ContextSubscriptionOptions? options = null, CancellationToken cancellationToken = default) + public Task OnEntryAddedAsync(Func handler, ContextSubscriptionOptions? options = null, CancellationToken cancellationToken = default) { if (handler is null) throw new ArgumentNullException(nameof(handler)); @@ -33,7 +33,7 @@ public Task OnEntryAddedAsync(Func handler, Co cancellationToken); } - public Task OnEntryAddedAsync(Action handler, ContextSubscriptionOptions? options = null, CancellationToken cancellationToken = default) + public Task OnEntryAddedAsync(Action handler, ContextSubscriptionOptions? options = null, CancellationToken cancellationToken = default) { if (handler is null) throw new ArgumentNullException(nameof(handler)); @@ -43,7 +43,7 @@ public Task OnEntryAddedAsync(Action handler, Contex cancellationToken); } - private async Task HandleEntryAddedAsync(Log.LogEntry e, Func handler) + private async Task HandleEntryAddedAsync(LogEntryEventArgs e, Func handler) { if (context.Equals(e.Source.Context)) { @@ -51,7 +51,7 @@ private async Task HandleEntryAddedAsync(Log.LogEntry e, Func handler) + private void HandleEntryAdded(LogEntryEventArgs e, Action handler) { if (context.Equals(e.Source.Context)) { diff --git a/dotnet/src/webdriver/BiDi/Json/Converters/Polymorphic/LogEntryConverter.cs b/dotnet/src/webdriver/BiDi/Json/Converters/Polymorphic/LogEntryEventArgsConverter.cs similarity index 71% rename from dotnet/src/webdriver/BiDi/Json/Converters/Polymorphic/LogEntryConverter.cs rename to dotnet/src/webdriver/BiDi/Json/Converters/Polymorphic/LogEntryEventArgsConverter.cs index e1415fbdd99a0..e60ec6764d725 100644 --- a/dotnet/src/webdriver/BiDi/Json/Converters/Polymorphic/LogEntryConverter.cs +++ b/dotnet/src/webdriver/BiDi/Json/Converters/Polymorphic/LogEntryEventArgsConverter.cs @@ -1,4 +1,4 @@ -// +// // Licensed to the Software Freedom Conservancy (SFC) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information @@ -24,19 +24,19 @@ namespace OpenQA.Selenium.BiDi.Json.Converters.Polymorphic; // https://github.com/dotnet/runtime/issues/72604 -internal class LogEntryConverter : JsonConverter +internal class LogEntryEventArgsConverter : JsonConverter { - public override Log.LogEntry? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override LogEntryEventArgs? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return reader.GetDiscriminator("type") switch { - "console" => JsonSerializer.Deserialize(ref reader, options.GetTypeInfo()), - "javascript" => JsonSerializer.Deserialize(ref reader, options.GetTypeInfo()), - _ => JsonSerializer.Deserialize(ref reader, options.GetTypeInfo()), + "console" => JsonSerializer.Deserialize(ref reader, options.GetTypeInfo()), + "javascript" => JsonSerializer.Deserialize(ref reader, options.GetTypeInfo()), + _ => JsonSerializer.Deserialize(ref reader, options.GetTypeInfo()), }; } - public override void Write(Utf8JsonWriter writer, Log.LogEntry value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, LogEntryEventArgs value, JsonSerializerOptions options) { throw new NotImplementedException(); } diff --git a/dotnet/src/webdriver/BiDi/Log/LogEntry.cs b/dotnet/src/webdriver/BiDi/Log/LogEntryEventArgs.cs similarity index 55% rename from dotnet/src/webdriver/BiDi/Log/LogEntry.cs rename to dotnet/src/webdriver/BiDi/Log/LogEntryEventArgs.cs index 0c06c4bd09c4a..1f0d6c4e9aa62 100644 --- a/dotnet/src/webdriver/BiDi/Log/LogEntry.cs +++ b/dotnet/src/webdriver/BiDi/Log/LogEntryEventArgs.cs @@ -1,4 +1,4 @@ -// +// // Licensed to the Software Freedom Conservancy (SFC) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information @@ -25,24 +25,24 @@ namespace OpenQA.Selenium.BiDi.Log; // https://github.com/dotnet/runtime/issues/72604 //[JsonPolymorphic(TypeDiscriminatorPropertyName = "type")] -//[JsonDerivedType(typeof(GenericLogEntry))] -//[JsonDerivedType(typeof(ConsoleLogEntry), "console")] -//[JsonDerivedType(typeof(JavascriptLogEntry), "javascript")] -[JsonConverter(typeof(LogEntryConverter))] -public abstract record LogEntry(Level Level, Script.Source Source, string? Text, DateTimeOffset Timestamp) +//[JsonDerivedType(typeof(GenericLogEntryEventArgs))] +//[JsonDerivedType(typeof(ConsoleLogEntryEventArgs), "console")] +//[JsonDerivedType(typeof(JavascriptLogEntryEventArgs), "javascript")] +[JsonConverter(typeof(LogEntryEventArgsConverter))] +public abstract record LogEntryEventArgs(Level Level, Script.Source Source, string? Text, DateTimeOffset Timestamp) : EventArgs { public Script.StackTrace? StackTrace { get; init; } } -public sealed record GenericLogEntry(string Type, Level Level, Script.Source Source, string? Text, DateTimeOffset Timestamp) - : LogEntry(Level, Source, Text, Timestamp); +public sealed record GenericLogEntryEventArgs(string Type, Level Level, Script.Source Source, string? Text, DateTimeOffset Timestamp) + : LogEntryEventArgs(Level, Source, Text, Timestamp); -public sealed record ConsoleLogEntry(Level Level, Script.Source Source, string? Text, DateTimeOffset Timestamp, string Method, IReadOnlyList Args) - : LogEntry(Level, Source, Text, Timestamp); +public sealed record ConsoleLogEntryEventArgs(Level Level, Script.Source Source, string? Text, DateTimeOffset Timestamp, string Method, IReadOnlyList Args) + : LogEntryEventArgs(Level, Source, Text, Timestamp); -public sealed record JavascriptLogEntry(Level Level, Script.Source Source, string? Text, DateTimeOffset Timestamp) - : LogEntry(Level, Source, Text, Timestamp); +public sealed record JavascriptLogEntryEventArgs(Level Level, Script.Source Source, string? Text, DateTimeOffset Timestamp) + : LogEntryEventArgs(Level, Source, Text, Timestamp); [JsonConverter(typeof(CamelCaseEnumConverter))] public enum Level diff --git a/dotnet/src/webdriver/BiDi/Log/LogModule.cs b/dotnet/src/webdriver/BiDi/Log/LogModule.cs index 81a4b0d8e98fa..843f92e0a293b 100644 --- a/dotnet/src/webdriver/BiDi/Log/LogModule.cs +++ b/dotnet/src/webdriver/BiDi/Log/LogModule.cs @@ -27,14 +27,14 @@ public sealed class LogModule : Module { private LogJsonSerializerContext _jsonContext = null!; - public async Task OnEntryAddedAsync(Func handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) + public async Task OnEntryAddedAsync(Func handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) { - return await SubscribeAsync("log.entryAdded", handler, options, _jsonContext.LogEntry, cancellationToken).ConfigureAwait(false); + return await SubscribeAsync("log.entryAdded", handler, options, _jsonContext.LogEntryEventArgs, cancellationToken).ConfigureAwait(false); } - public async Task OnEntryAddedAsync(Action handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) + public async Task OnEntryAddedAsync(Action handler, SubscriptionOptions? options = null, CancellationToken cancellationToken = default) { - return await SubscribeAsync("log.entryAdded", handler, options, _jsonContext.LogEntry, cancellationToken).ConfigureAwait(false); + return await SubscribeAsync("log.entryAdded", handler, options, _jsonContext.LogEntryEventArgs, cancellationToken).ConfigureAwait(false); } protected override void Initialize(BiDi bidi, JsonSerializerOptions jsonSerializerOptions) @@ -78,12 +78,12 @@ protected override void Initialize(BiDi bidi, JsonSerializerOptions jsonSerializ [JsonSerializable(typeof(Script.WindowProxyRemoteValue))] #endregion +[JsonSerializable(typeof(LogEntryEventArgs))] + #region https://github.com/dotnet/runtime/issues/72604 -[JsonSerializable(typeof(GenericLogEntry))] -[JsonSerializable(typeof(ConsoleLogEntry))] -[JsonSerializable(typeof(JavascriptLogEntry))] +[JsonSerializable(typeof(GenericLogEntryEventArgs))] +[JsonSerializable(typeof(ConsoleLogEntryEventArgs))] +[JsonSerializable(typeof(JavascriptLogEntryEventArgs))] #endregion -[JsonSerializable(typeof(LogEntry))] - internal partial class LogJsonSerializerContext : JsonSerializerContext; diff --git a/dotnet/test/common/BiDi/Log/LogTests.cs b/dotnet/test/common/BiDi/Log/LogTests.cs index 524dea818bf63..e7a70e59f8195 100644 --- a/dotnet/test/common/BiDi/Log/LogTests.cs +++ b/dotnet/test/common/BiDi/Log/LogTests.cs @@ -28,7 +28,7 @@ internal class LogTests : BiDiTestFixture [Test] public async Task CanListenToConsoleLog() { - TaskCompletionSource tcs = new(); + TaskCompletionSource tcs = new(); await using var subscription = await context.Log.OnEntryAddedAsync(tcs.SetResult); @@ -43,9 +43,9 @@ public async Task CanListenToConsoleLog() Assert.That(logEntry.Source.Realm, Is.Not.Null); Assert.That(logEntry.Text, Is.EqualTo("Hello, world!")); Assert.That(logEntry.Level, Is.EqualTo(Level.Info)); - Assert.That(logEntry, Is.AssignableFrom()); + Assert.That(logEntry, Is.AssignableFrom()); - var consoleLogEntry = logEntry as ConsoleLogEntry; + var consoleLogEntry = logEntry as ConsoleLogEntryEventArgs; Assert.That(consoleLogEntry.Method, Is.EqualTo("log")); @@ -57,7 +57,7 @@ public async Task CanListenToConsoleLog() [Test] public async Task CanListenToJavascriptLog() { - TaskCompletionSource tcs = new(); + TaskCompletionSource tcs = new(); await using var subscription = await context.Log.OnEntryAddedAsync(tcs.SetResult); @@ -72,13 +72,13 @@ public async Task CanListenToJavascriptLog() Assert.That(logEntry.Source.Realm, Is.Not.Null); Assert.That(logEntry.Text, Is.EqualTo("Error: Not working")); Assert.That(logEntry.Level, Is.EqualTo(Level.Error)); - Assert.That(logEntry, Is.AssignableFrom()); + Assert.That(logEntry, Is.AssignableFrom()); } [Test] public async Task CanRetrieveStacktrace() { - TaskCompletionSource tcs = new(); + TaskCompletionSource tcs = new(); await using var subscription = await bidi.Log.OnEntryAddedAsync(tcs.SetResult); diff --git a/dotnet/test/common/BiDi/Script/ScriptCommandsTests.cs b/dotnet/test/common/BiDi/Script/ScriptCommandsTests.cs index 541beef5e8992..d3d593201e0f0 100644 --- a/dotnet/test/common/BiDi/Script/ScriptCommandsTests.cs +++ b/dotnet/test/common/BiDi/Script/ScriptCommandsTests.cs @@ -92,7 +92,7 @@ public async Task CanAddPreloadScript() Assert.That(preloadScript, Is.Not.Null); - TaskCompletionSource tcs = new(); + TaskCompletionSource tcs = new(); await context.Log.OnEntryAddedAsync(tcs.SetResult);