diff --git a/dotnet/src/webdriver/BiDi/Browser/BrowserModule.cs b/dotnet/src/webdriver/BiDi/Browser/BrowserModule.cs index d09c88f446eac..61c5ce4008f05 100644 --- a/dotnet/src/webdriver/BiDi/Browser/BrowserModule.cs +++ b/dotnet/src/webdriver/BiDi/Browser/BrowserModule.cs @@ -24,16 +24,16 @@ namespace OpenQA.Selenium.BiDi.Browser; public sealed class BrowserModule : Module { - public async Task CloseAsync(CloseOptions? options = null) + public async Task CloseAsync(CloseOptions? options = null) { - return await Broker.ExecuteCommandAsync(new CloseCommand(), options, JsonContext.Browser_CloseCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new CloseCommand(), options, JsonContext.Browser_CloseCommand, JsonContext.Browser_CloseResult).ConfigureAwait(false); } - public async Task CreateUserContextAsync(CreateUserContextOptions? options = null) + public async Task CreateUserContextAsync(CreateUserContextOptions? options = null) { var @params = new CreateUserContextParameters(options?.AcceptInsecureCerts, options?.Proxy, options?.UnhandledPromptBehavior); - return await Broker.ExecuteCommandAsync(new CreateUserContextCommand(@params), options, JsonContext.CreateUserContextCommand, JsonContext.UserContextInfo).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new CreateUserContextCommand(@params), options, JsonContext.CreateUserContextCommand, JsonContext.CreateUserContextResult).ConfigureAwait(false); } public async Task GetUserContextsAsync(GetUserContextsOptions? options = null) @@ -41,11 +41,11 @@ public async Task GetUserContextsAsync(GetUserContextsOpt return await Broker.ExecuteCommandAsync(new GetUserContextsCommand(), options, JsonContext.GetUserContextsCommand, JsonContext.GetUserContextsResult).ConfigureAwait(false); } - public async Task RemoveUserContextAsync(UserContext userContext, RemoveUserContextOptions? options = null) + public async Task RemoveUserContextAsync(UserContext userContext, RemoveUserContextOptions? options = null) { var @params = new RemoveUserContextParameters(userContext); - return await Broker.ExecuteCommandAsync(new RemoveUserContextCommand(@params), options, JsonContext.RemoveUserContextCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new RemoveUserContextCommand(@params), options, JsonContext.RemoveUserContextCommand, JsonContext.RemoveUserContextResult).ConfigureAwait(false); } public async Task GetClientWindowsAsync(GetClientWindowsOptions? options = null) @@ -54,24 +54,24 @@ public async Task GetClientWindowsAsync(GetClientWindows ).ConfigureAwait(false); } - public async Task SetDownloadBehaviorAllowedAsync(string destinationFolder, SetDownloadBehaviorOptions? options = null) + public async Task SetDownloadBehaviorAllowedAsync(string destinationFolder, SetDownloadBehaviorOptions? options = null) { var @params = new SetDownloadBehaviorParameters(new DownloadBehaviorAllowed(destinationFolder), options?.UserContexts); - return await Broker.ExecuteCommandAsync(new SetDownloadBehaviorCommand(@params), options, JsonContext.SetDownloadBehaviorCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new SetDownloadBehaviorCommand(@params), options, JsonContext.SetDownloadBehaviorCommand, JsonContext.SetDownloadBehaviorResult).ConfigureAwait(false); } - public async Task SetDownloadBehaviorAllowedAsync(SetDownloadBehaviorOptions? options = null) + public async Task SetDownloadBehaviorAllowedAsync(SetDownloadBehaviorOptions? options = null) { var @params = new SetDownloadBehaviorParameters(null, options?.UserContexts); - return await Broker.ExecuteCommandAsync(new SetDownloadBehaviorCommand(@params), options, JsonContext.SetDownloadBehaviorCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new SetDownloadBehaviorCommand(@params), options, JsonContext.SetDownloadBehaviorCommand, JsonContext.SetDownloadBehaviorResult).ConfigureAwait(false); } - public async Task SetDownloadBehaviorDeniedAsync(SetDownloadBehaviorOptions? options = null) + public async Task SetDownloadBehaviorDeniedAsync(SetDownloadBehaviorOptions? options = null) { var @params = new SetDownloadBehaviorParameters(new DownloadBehaviorDenied(), options?.UserContexts); - return await Broker.ExecuteCommandAsync(new SetDownloadBehaviorCommand(@params), options, JsonContext.SetDownloadBehaviorCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new SetDownloadBehaviorCommand(@params), options, JsonContext.SetDownloadBehaviorCommand, JsonContext.SetDownloadBehaviorResult).ConfigureAwait(false); } } diff --git a/dotnet/src/webdriver/BiDi/Browser/CloseCommand.cs b/dotnet/src/webdriver/BiDi/Browser/CloseCommand.cs index b7f157c14aaa1..10b2943d375e8 100644 --- a/dotnet/src/webdriver/BiDi/Browser/CloseCommand.cs +++ b/dotnet/src/webdriver/BiDi/Browser/CloseCommand.cs @@ -22,6 +22,8 @@ namespace OpenQA.Selenium.BiDi.Browser; internal sealed class CloseCommand() - : Command(Parameters.Empty, "browser.close"); + : Command(Parameters.Empty, "browser.close"); public sealed class CloseOptions : CommandOptions; + +public sealed record CloseResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Browser/CreateUserContextCommand.cs b/dotnet/src/webdriver/BiDi/Browser/CreateUserContextCommand.cs index 796e8c2b26ea5..f8ecd399063a1 100644 --- a/dotnet/src/webdriver/BiDi/Browser/CreateUserContextCommand.cs +++ b/dotnet/src/webdriver/BiDi/Browser/CreateUserContextCommand.cs @@ -22,7 +22,7 @@ namespace OpenQA.Selenium.BiDi.Browser; internal sealed class CreateUserContextCommand(CreateUserContextParameters @params) - : Command(@params, "browser.createUserContext"); + : Command(@params, "browser.createUserContext"); internal sealed record CreateUserContextParameters(bool? AcceptInsecureCerts, Session.ProxyConfiguration? Proxy, Session.UserPromptHandler? UnhandledPromptBehavior) : Parameters; @@ -34,3 +34,5 @@ public sealed class CreateUserContextOptions : CommandOptions public Session.UserPromptHandler? UnhandledPromptBehavior { get; set; } } + +public sealed record CreateUserContextResult(UserContext UserContext) : UserContextInfo(UserContext); diff --git a/dotnet/src/webdriver/BiDi/Browser/GetClientWindowsCommand.cs b/dotnet/src/webdriver/BiDi/Browser/GetClientWindowsCommand.cs index f5482e65c8b0a..ddb000303cad2 100644 --- a/dotnet/src/webdriver/BiDi/Browser/GetClientWindowsCommand.cs +++ b/dotnet/src/webdriver/BiDi/Browser/GetClientWindowsCommand.cs @@ -44,8 +44,6 @@ internal GetClientWindowsResult(IReadOnlyList clientWindows) public int Count => ClientWindows.Count; - - public IEnumerator GetEnumerator() => ClientWindows.GetEnumerator(); IEnumerator IEnumerable.GetEnumerator() => (ClientWindows as IEnumerable).GetEnumerator(); diff --git a/dotnet/src/webdriver/BiDi/Browser/RemoveUserContextCommand.cs b/dotnet/src/webdriver/BiDi/Browser/RemoveUserContextCommand.cs index 926759c64ebdd..4e628ef5b4060 100644 --- a/dotnet/src/webdriver/BiDi/Browser/RemoveUserContextCommand.cs +++ b/dotnet/src/webdriver/BiDi/Browser/RemoveUserContextCommand.cs @@ -22,8 +22,10 @@ namespace OpenQA.Selenium.BiDi.Browser; internal sealed class RemoveUserContextCommand(RemoveUserContextParameters @params) - : Command(@params, "browser.removeUserContext"); + : Command(@params, "browser.removeUserContext"); internal sealed record RemoveUserContextParameters(UserContext UserContext) : Parameters; public sealed class RemoveUserContextOptions : CommandOptions; + +public sealed record RemoveUserContextResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Browser/SetDownloadBehaviorCommand.cs b/dotnet/src/webdriver/BiDi/Browser/SetDownloadBehaviorCommand.cs index 9660dc5b90326..8ba02441392db 100644 --- a/dotnet/src/webdriver/BiDi/Browser/SetDownloadBehaviorCommand.cs +++ b/dotnet/src/webdriver/BiDi/Browser/SetDownloadBehaviorCommand.cs @@ -24,7 +24,7 @@ namespace OpenQA.Selenium.BiDi.Browser; internal sealed class SetDownloadBehaviorCommand(SetDownloadBehaviorParameters @params) - : Command(@params, "browser.setDownloadBehavior"); + : Command(@params, "browser.setDownloadBehavior"); internal sealed record SetDownloadBehaviorParameters([property: JsonIgnore(Condition = JsonIgnoreCondition.Never)] DownloadBehavior? DownloadBehavior, IEnumerable? UserContexts) : Parameters; @@ -41,3 +41,5 @@ public sealed class SetDownloadBehaviorOptions : CommandOptions { public IEnumerable? UserContexts { get; set; } } + +public sealed record SetDownloadBehaviorResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Browser/UserContextInfo.cs b/dotnet/src/webdriver/BiDi/Browser/UserContextInfo.cs index 7440624658b1f..724021671572a 100644 --- a/dotnet/src/webdriver/BiDi/Browser/UserContextInfo.cs +++ b/dotnet/src/webdriver/BiDi/Browser/UserContextInfo.cs @@ -21,4 +21,4 @@ namespace OpenQA.Selenium.BiDi.Browser; -public sealed record UserContextInfo(UserContext UserContext) : EmptyResult; +public record UserContextInfo(UserContext UserContext) : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/ActivateCommand.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/ActivateCommand.cs index 07dff55099a2a..33d3e9f491f9c 100644 --- a/dotnet/src/webdriver/BiDi/BrowsingContext/ActivateCommand.cs +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/ActivateCommand.cs @@ -22,8 +22,10 @@ namespace OpenQA.Selenium.BiDi.BrowsingContext; internal sealed class ActivateCommand(ActivateParameters @params) - : Command(@params, "browsingContext.activate"); + : Command(@params, "browsingContext.activate"); internal sealed record ActivateParameters(BrowsingContext Context) : Parameters; public sealed class ActivateOptions : CommandOptions; + +public sealed record ActivateResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContext.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContext.cs index 178ba5d9519a4..56191fc082e33 100644 --- a/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContext.cs +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContext.cs @@ -62,12 +62,12 @@ public Task NavigateAsync(string url, NavigateOptions? options = return BiDi.BrowsingContext.NavigateAsync(this, url, options); } - public Task ReloadAsync(ReloadOptions? options = null) + public Task ReloadAsync(ReloadOptions? options = null) { return BiDi.BrowsingContext.ReloadAsync(this, options); } - public Task ActivateAsync(ActivateOptions? options = null) + public Task ActivateAsync(ActivateOptions? options = null) { return BiDi.BrowsingContext.ActivateAsync(this, options); } @@ -82,7 +82,7 @@ public Task CaptureScreenshotAsync(CaptureScreenshotOpt return BiDi.BrowsingContext.CaptureScreenshotAsync(this, options); } - public Task CloseAsync(CloseOptions? options = null) + public Task CloseAsync(CloseOptions? options = null) { return BiDi.BrowsingContext.CloseAsync(this, options); } @@ -92,7 +92,7 @@ public Task TraverseHistoryAsync(int delta, TraverseHisto return BiDi.BrowsingContext.TraverseHistoryAsync(this, delta, options); } - public Task SetViewportAsync(SetViewportOptions? options = null) + public Task SetViewportAsync(SetViewportOptions? options = null) { return BiDi.BrowsingContext.SetViewportAsync(this, options); } @@ -102,7 +102,7 @@ public Task PrintAsync(PrintOptions? options = null) return BiDi.BrowsingContext.PrintAsync(this, options); } - public Task HandleUserPromptAsync(HandleUserPromptOptions? options = null) + public Task HandleUserPromptAsync(HandleUserPromptOptions? options = null) { return BiDi.BrowsingContext.HandleUserPromptAsync(this, options); } diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextInputModule.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextInputModule.cs index dd564eb4e00ee..1a77c4fecc38c 100644 --- a/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextInputModule.cs +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextInputModule.cs @@ -20,23 +20,22 @@ using System.Threading.Tasks; using OpenQA.Selenium.BiDi.Input; using System.Collections.Generic; -using OpenQA.Selenium.BiDi.Communication; namespace OpenQA.Selenium.BiDi.BrowsingContext; public sealed class BrowsingContextInputModule(BrowsingContext context, InputModule inputModule) { - public Task PerformActionsAsync(IEnumerable actions, PerformActionsOptions? options = null) + public Task PerformActionsAsync(IEnumerable actions, PerformActionsOptions? options = null) { return inputModule.PerformActionsAsync(context, actions, options); } - public Task ReleaseActionsAsync(ReleaseActionsOptions? options = null) + public Task ReleaseActionsAsync(ReleaseActionsOptions? options = null) { return inputModule.ReleaseActionsAsync(context, options); } - public Task SetFilesAsync(Script.ISharedReference element, IEnumerable files, SetFilesOptions? options = null) + public Task SetFilesAsync(Script.ISharedReference element, IEnumerable files, SetFilesOptions? options = null) { return inputModule.SetFilesAsync(context, element, files, options); } diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextModule.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextModule.cs index 7420e4dcb4ab7..f50d23085da40 100644 --- a/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextModule.cs +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextModule.cs @@ -25,13 +25,11 @@ namespace OpenQA.Selenium.BiDi.BrowsingContext; public sealed class BrowsingContextModule : Module { - public async Task CreateAsync(ContextType type, CreateOptions? options = null) + public async Task CreateAsync(ContextType type, CreateOptions? options = null) { var @params = new CreateParameters(type, options?.ReferenceContext, options?.Background, options?.UserContext); - var createResult = await Broker.ExecuteCommandAsync(new CreateCommand(@params), options, JsonContext.CreateCommand, JsonContext.CreateResult).ConfigureAwait(false); - - return createResult.Context; + return await Broker.ExecuteCommandAsync(new CreateCommand(@params), options, JsonContext.CreateCommand, JsonContext.CreateResult).ConfigureAwait(false); } public async Task NavigateAsync(BrowsingContext context, string url, NavigateOptions? options = null) @@ -41,11 +39,11 @@ public async Task NavigateAsync(BrowsingContext context, string return await Broker.ExecuteCommandAsync(new NavigateCommand(@params), options, JsonContext.NavigateCommand, JsonContext.NavigateResult).ConfigureAwait(false); } - public async Task ActivateAsync(BrowsingContext context, ActivateOptions? options = null) + public async Task ActivateAsync(BrowsingContext context, ActivateOptions? options = null) { var @params = new ActivateParameters(context); - return await Broker.ExecuteCommandAsync(new ActivateCommand(@params), options, JsonContext.ActivateCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new ActivateCommand(@params), options, JsonContext.ActivateCommand, JsonContext.ActivateResult).ConfigureAwait(false); } public async Task LocateNodesAsync(BrowsingContext context, Locator locator, LocateNodesOptions? options = null) @@ -62,11 +60,11 @@ public async Task CaptureScreenshotAsync(BrowsingContex return await Broker.ExecuteCommandAsync(new CaptureScreenshotCommand(@params), options, JsonContext.CaptureScreenshotCommand, JsonContext.CaptureScreenshotResult).ConfigureAwait(false); } - public async Task CloseAsync(BrowsingContext context, CloseOptions? options = null) + public async Task CloseAsync(BrowsingContext context, CloseOptions? options = null) { var @params = new CloseParameters(context, options?.PromptUnload); - return await Broker.ExecuteCommandAsync(new CloseCommand(@params), options, JsonContext.BrowsingContext_CloseCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new CloseCommand(@params), options, JsonContext.BrowsingContext_CloseCommand, JsonContext.BrowsingContext_CloseResult).ConfigureAwait(false); } public async Task TraverseHistoryAsync(BrowsingContext context, int delta, TraverseHistoryOptions? options = null) @@ -76,18 +74,18 @@ public async Task TraverseHistoryAsync(BrowsingContext co return await Broker.ExecuteCommandAsync(new TraverseHistoryCommand(@params), options, JsonContext.TraverseHistoryCommand, JsonContext.TraverseHistoryResult).ConfigureAwait(false); } - public async Task ReloadAsync(BrowsingContext context, ReloadOptions? options = null) + public async Task ReloadAsync(BrowsingContext context, ReloadOptions? options = null) { var @params = new ReloadParameters(context, options?.IgnoreCache, options?.Wait); - return await Broker.ExecuteCommandAsync(new ReloadCommand(@params), options, JsonContext.ReloadCommand, JsonContext.NavigateResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new ReloadCommand(@params), options, JsonContext.ReloadCommand, JsonContext.ReloadResult).ConfigureAwait(false); } - public async Task SetViewportAsync(BrowsingContext context, SetViewportOptions? options = null) + public async Task SetViewportAsync(BrowsingContext context, SetViewportOptions? options = null) { var @params = new SetViewportParameters(context, options?.Viewport, options?.DevicePixelRatio); - return await Broker.ExecuteCommandAsync(new SetViewportCommand(@params), options, JsonContext.SetViewportCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new SetViewportCommand(@params), options, JsonContext.SetViewportCommand, JsonContext.SetViewportResult).ConfigureAwait(false); } public async Task GetTreeAsync(GetTreeOptions? options = null) @@ -104,11 +102,11 @@ public async Task PrintAsync(BrowsingContext context, PrintOptions? return await Broker.ExecuteCommandAsync(new PrintCommand(@params), options, JsonContext.PrintCommand, JsonContext.PrintResult).ConfigureAwait(false); } - public async Task HandleUserPromptAsync(BrowsingContext context, HandleUserPromptOptions? options = null) + public async Task HandleUserPromptAsync(BrowsingContext context, HandleUserPromptOptions? options = null) { var @params = new HandleUserPromptParameters(context, options?.Accept, options?.UserText); - return await Broker.ExecuteCommandAsync(new HandleUserPromptCommand(@params), options, JsonContext.HandleUserPromptCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new HandleUserPromptCommand(@params), options, JsonContext.HandleUserPromptCommand, JsonContext.HandleUserPromptResult).ConfigureAwait(false); } public async Task OnNavigationStartedAsync(Func handler, BrowsingContextsSubscriptionOptions? options = null) diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextNetworkModule.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextNetworkModule.cs index ab6ef05f0f881..46703be62af13 100644 --- a/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextNetworkModule.cs +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextNetworkModule.cs @@ -20,7 +20,6 @@ using System.Threading.Tasks; using System; using OpenQA.Selenium.BiDi.Network; -using OpenQA.Selenium.BiDi.Communication; namespace OpenQA.Selenium.BiDi.BrowsingContext; @@ -74,7 +73,7 @@ await intercept.OnAuthRequiredAsync( return intercept; } - public Task SetCacheBehaviorAsync(CacheBehavior behavior, BrowsingContextSetCacheBehaviorOptions? options = null) + public Task SetCacheBehaviorAsync(CacheBehavior behavior, BrowsingContextSetCacheBehaviorOptions? options = null) { SetCacheBehaviorOptions setCacheBehaviorOptions = new(options) { diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextScriptModule.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextScriptModule.cs index 5d9d279fe5059..df91a3e893a2f 100644 --- a/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextScriptModule.cs +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextScriptModule.cs @@ -19,13 +19,12 @@ using System.Threading.Tasks; using OpenQA.Selenium.BiDi.Script; -using System.Collections.Generic; namespace OpenQA.Selenium.BiDi.BrowsingContext; public sealed class BrowsingContextScriptModule(BrowsingContext context, ScriptModule scriptModule) { - public async Task AddPreloadScriptAsync(string functionDeclaration, BrowsingContextAddPreloadScriptOptions? options = null) + public async Task AddPreloadScriptAsync(string functionDeclaration, BrowsingContextAddPreloadScriptOptions? options = null) { AddPreloadScriptOptions addPreloadScriptOptions = new(options) { @@ -35,7 +34,7 @@ public async Task AddPreloadScriptAsync(string functionDeclaratio return await scriptModule.AddPreloadScriptAsync(functionDeclaration, addPreloadScriptOptions).ConfigureAwait(false); } - public async Task> GetRealmsAsync(GetRealmsOptions? options = null) + public async Task GetRealmsAsync(GetRealmsOptions? options = null) { options ??= new(); diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/CloseCommand.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/CloseCommand.cs index afe451c4083bc..c13ac11feb399 100644 --- a/dotnet/src/webdriver/BiDi/BrowsingContext/CloseCommand.cs +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/CloseCommand.cs @@ -22,7 +22,7 @@ namespace OpenQA.Selenium.BiDi.BrowsingContext; internal sealed class CloseCommand(CloseParameters @params) - : Command(@params, "browsingContext.close"); + : Command(@params, "browsingContext.close"); internal sealed record CloseParameters(BrowsingContext Context, bool? PromptUnload) : Parameters; @@ -30,3 +30,5 @@ public sealed class CloseOptions : CommandOptions { public bool? PromptUnload { get; set; } } + +public sealed record CloseResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/HandleUserPromptCommand.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/HandleUserPromptCommand.cs index 6789651f79074..d15f1c601b79a 100644 --- a/dotnet/src/webdriver/BiDi/BrowsingContext/HandleUserPromptCommand.cs +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/HandleUserPromptCommand.cs @@ -22,7 +22,7 @@ namespace OpenQA.Selenium.BiDi.BrowsingContext; internal sealed class HandleUserPromptCommand(HandleUserPromptParameters @params) - : Command(@params, "browsingContext.handleUserPrompt"); + : Command(@params, "browsingContext.handleUserPrompt"); internal sealed record HandleUserPromptParameters(BrowsingContext Context, bool? Accept, string? UserText) : Parameters; @@ -32,3 +32,5 @@ public sealed class HandleUserPromptOptions : CommandOptions public string? UserText { get; set; } } + +public sealed record HandleUserPromptResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/NavigateCommand.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/NavigateCommand.cs index f942e3b187124..c8b53d40dbc10 100644 --- a/dotnet/src/webdriver/BiDi/BrowsingContext/NavigateCommand.cs +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/NavigateCommand.cs @@ -41,4 +41,4 @@ public enum ReadinessState Complete } -public sealed record NavigateResult(Navigation? Navigation, string Url) : EmptyResult; +public record NavigateResult(Navigation? Navigation, string Url) : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/ReloadCommand.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/ReloadCommand.cs index ec348b51ae3d1..ba1e8c7d30215 100644 --- a/dotnet/src/webdriver/BiDi/BrowsingContext/ReloadCommand.cs +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/ReloadCommand.cs @@ -22,7 +22,7 @@ namespace OpenQA.Selenium.BiDi.BrowsingContext; internal sealed class ReloadCommand(ReloadParameters @params) - : Command(@params, "browsingContext.reload"); + : Command(@params, "browsingContext.reload"); internal sealed record ReloadParameters(BrowsingContext Context, bool? IgnoreCache, ReadinessState? Wait) : Parameters; @@ -32,3 +32,5 @@ public sealed class ReloadOptions : CommandOptions public ReadinessState? Wait { get; set; } } + +public sealed record ReloadResult(Navigation? Navigation, string Url) : NavigateResult(Navigation, Url); diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/SetViewportCommand.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/SetViewportCommand.cs index 41260597592dc..781f68d3765cf 100644 --- a/dotnet/src/webdriver/BiDi/BrowsingContext/SetViewportCommand.cs +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/SetViewportCommand.cs @@ -22,7 +22,7 @@ namespace OpenQA.Selenium.BiDi.BrowsingContext; internal sealed class SetViewportCommand(SetViewportParameters @params) - : Command(@params, "browsingContext.setViewport"); + : Command(@params, "browsingContext.setViewport"); internal sealed record SetViewportParameters(BrowsingContext Context, Viewport? Viewport, double? DevicePixelRatio) : Parameters; @@ -34,3 +34,5 @@ public sealed class SetViewportOptions : CommandOptions } public readonly record struct Viewport(long Width, long Height); + +public sealed record SetViewportResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Communication/Command.cs b/dotnet/src/webdriver/BiDi/Communication/Command.cs index 0fd27b28566dd..d84f99400f526 100644 --- a/dotnet/src/webdriver/BiDi/Communication/Command.cs +++ b/dotnet/src/webdriver/BiDi/Communication/Command.cs @@ -53,4 +53,4 @@ internal record Parameters public static Parameters Empty { get; } = new Parameters(); } -public record EmptyResult; +public abstract record EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Communication/Json/BiDiJsonSerializerContext.cs b/dotnet/src/webdriver/BiDi/Communication/Json/BiDiJsonSerializerContext.cs index 3d41f33d64483..0f35020aba048 100644 --- a/dotnet/src/webdriver/BiDi/Communication/Json/BiDiJsonSerializerContext.cs +++ b/dotnet/src/webdriver/BiDi/Communication/Json/BiDiJsonSerializerContext.cs @@ -75,32 +75,40 @@ namespace OpenQA.Selenium.BiDi.Communication.Json; [JsonSerializable(typeof(Session.NewCommand))] [JsonSerializable(typeof(Session.NewResult))] [JsonSerializable(typeof(Session.EndCommand))] +[JsonSerializable(typeof(Session.EndResult))] [JsonSerializable(typeof(Session.SubscribeCommand))] [JsonSerializable(typeof(Session.SubscribeResult))] [JsonSerializable(typeof(Session.UnsubscribeByIdCommand))] +[JsonSerializable(typeof(Session.UnsubscribeResult))] [JsonSerializable(typeof(Browser.CloseCommand), TypeInfoPropertyName = "Browser_CloseCommand")] +[JsonSerializable(typeof(Browser.CloseResult), TypeInfoPropertyName = "Browser_CloseResult")] [JsonSerializable(typeof(Browser.CreateUserContextCommand))] +[JsonSerializable(typeof(Browser.CreateUserContextResult))] [JsonSerializable(typeof(Browser.GetUserContextsCommand))] [JsonSerializable(typeof(Browser.GetUserContextsResult))] [JsonSerializable(typeof(Browser.RemoveUserContextCommand))] +[JsonSerializable(typeof(Browser.RemoveUserContextResult))] [JsonSerializable(typeof(Browser.GetClientWindowsCommand))] [JsonSerializable(typeof(Browser.GetClientWindowsResult))] [JsonSerializable(typeof(Browser.SetDownloadBehaviorCommand))] -[JsonSerializable(typeof(Browser.UserContextInfo))] +[JsonSerializable(typeof(Browser.SetDownloadBehaviorResult))] [JsonSerializable(typeof(IReadOnlyList))] [JsonSerializable(typeof(IReadOnlyList))] [JsonSerializable(typeof(BrowsingContext.ActivateCommand))] +[JsonSerializable(typeof(BrowsingContext.ActivateResult))] [JsonSerializable(typeof(BrowsingContext.CaptureScreenshotCommand))] [JsonSerializable(typeof(BrowsingContext.CaptureScreenshotResult))] [JsonSerializable(typeof(BrowsingContext.CloseCommand), TypeInfoPropertyName = "BrowsingContext_CloseCommand")] +[JsonSerializable(typeof(BrowsingContext.CloseResult), TypeInfoPropertyName = "BrowsingContext_CloseResult")] [JsonSerializable(typeof(BrowsingContext.CreateCommand))] [JsonSerializable(typeof(BrowsingContext.CreateResult))] [JsonSerializable(typeof(BrowsingContext.GetTreeCommand))] [JsonSerializable(typeof(BrowsingContext.GetTreeResult))] [JsonSerializable(typeof(BrowsingContext.HandleUserPromptCommand))] +[JsonSerializable(typeof(BrowsingContext.HandleUserPromptResult))] [JsonSerializable(typeof(BrowsingContext.LocateNodesCommand))] [JsonSerializable(typeof(BrowsingContext.LocateNodesResult))] [JsonSerializable(typeof(BrowsingContext.NavigateCommand))] @@ -108,7 +116,9 @@ namespace OpenQA.Selenium.BiDi.Communication.Json; [JsonSerializable(typeof(BrowsingContext.PrintCommand))] [JsonSerializable(typeof(BrowsingContext.PrintResult))] [JsonSerializable(typeof(BrowsingContext.ReloadCommand))] +[JsonSerializable(typeof(BrowsingContext.ReloadResult))] [JsonSerializable(typeof(BrowsingContext.SetViewportCommand))] +[JsonSerializable(typeof(BrowsingContext.SetViewportResult))] [JsonSerializable(typeof(BrowsingContext.TraverseHistoryCommand))] [JsonSerializable(typeof(BrowsingContext.TraverseHistoryResult))] @@ -127,16 +137,25 @@ namespace OpenQA.Selenium.BiDi.Communication.Json; [JsonSerializable(typeof(Network.AddInterceptCommand))] [JsonSerializable(typeof(Network.AddInterceptResult))] [JsonSerializable(typeof(Network.ContinueRequestCommand))] +[JsonSerializable(typeof(Network.ContinueRequestResult))] [JsonSerializable(typeof(Network.ContinueResponseCommand))] +[JsonSerializable(typeof(Network.ContinueResponseResult))] [JsonSerializable(typeof(Network.ContinueWithAuthCommand))] +[JsonSerializable(typeof(Network.ContinueWithAuthResult))] [JsonSerializable(typeof(Network.FailRequestCommand))] +[JsonSerializable(typeof(Network.FailRequestResult))] [JsonSerializable(typeof(Network.GetDataCommand))] [JsonSerializable(typeof(Network.GetDataResult))] [JsonSerializable(typeof(Network.ProvideResponseCommand))] +[JsonSerializable(typeof(Network.ProvideResponseResult))] [JsonSerializable(typeof(Network.RemoveDataCollectorCommand))] +[JsonSerializable(typeof(Network.RemoveDataCollectorResult))] [JsonSerializable(typeof(Network.RemoveInterceptCommand))] +[JsonSerializable(typeof(Network.RemoveInterceptResult))] [JsonSerializable(typeof(Network.SetCacheBehaviorCommand))] +[JsonSerializable(typeof(Network.SetCacheBehaviorResult))] [JsonSerializable(typeof(Network.SetExtraHeadersCommand))] +[JsonSerializable(typeof(Network.SetExtraHeadersResult))] [JsonSerializable(typeof(Network.BeforeRequestSentEventArgs))] [JsonSerializable(typeof(Network.ResponseStartedEventArgs))] @@ -147,12 +166,15 @@ namespace OpenQA.Selenium.BiDi.Communication.Json; [JsonSerializable(typeof(Script.AddPreloadScriptCommand))] [JsonSerializable(typeof(Script.AddPreloadScriptResult))] [JsonSerializable(typeof(Script.DisownCommand))] +[JsonSerializable(typeof(Script.DisownResult))] [JsonSerializable(typeof(Script.CallFunctionCommand))] +[JsonSerializable(typeof(Script.EvaluateResult))] [JsonSerializable(typeof(Script.EvaluateCommand))] [JsonSerializable(typeof(Script.EvaluateResult))] [JsonSerializable(typeof(Script.GetRealmsCommand))] [JsonSerializable(typeof(Script.GetRealmsResult))] [JsonSerializable(typeof(Script.RemovePreloadScriptCommand))] +[JsonSerializable(typeof(Script.RemovePreloadScriptResult))] [JsonSerializable(typeof(Script.MessageEventArgs))] [JsonSerializable(typeof(Script.RealmDestroyedEventArgs))] @@ -168,8 +190,11 @@ namespace OpenQA.Selenium.BiDi.Communication.Json; [JsonSerializable(typeof(Storage.DeleteCookiesResult))] [JsonSerializable(typeof(Input.PerformActionsCommand))] +[JsonSerializable(typeof(Input.PerformActionsResult))] [JsonSerializable(typeof(Input.ReleaseActionsCommand))] +[JsonSerializable(typeof(Input.ReleaseActionsResult))] [JsonSerializable(typeof(Input.SetFilesCommand))] +[JsonSerializable(typeof(Input.SetFilesResult))] [JsonSerializable(typeof(IEnumerable))] [JsonSerializable(typeof(IEnumerable))] [JsonSerializable(typeof(IEnumerable))] @@ -178,12 +203,21 @@ namespace OpenQA.Selenium.BiDi.Communication.Json; [JsonSerializable(typeof(WebExtension.InstallCommand))] [JsonSerializable(typeof(WebExtension.InstallResult))] [JsonSerializable(typeof(WebExtension.UninstallCommand))] +[JsonSerializable(typeof(WebExtension.UninstallResult))] + [JsonSerializable(typeof(Emulation.SetTimezoneOverrideCommand))] +[JsonSerializable(typeof(Emulation.SetTimezoneOverrideResult))] [JsonSerializable(typeof(Emulation.SetUserAgentOverrideCommand))] +[JsonSerializable(typeof(Emulation.SetUserAgentOverrideResult))] [JsonSerializable(typeof(Emulation.SetLocaleOverrideCommand))] +[JsonSerializable(typeof(Emulation.SetLocaleOverrideResult))] [JsonSerializable(typeof(Emulation.SetForcedColorsModeThemeOverrideCommand))] +[JsonSerializable(typeof(Emulation.SetForcedColorsModeThemeOverrideResult))] [JsonSerializable(typeof(Emulation.SetScriptingEnabledCommand))] +[JsonSerializable(typeof(Emulation.SetScriptingEnabledResult))] [JsonSerializable(typeof(Emulation.SetScreenOrientationOverrideCommand))] +[JsonSerializable(typeof(Emulation.SetScreenOrientationOverrideResult))] [JsonSerializable(typeof(Emulation.SetGeolocationOverrideCommand))] +[JsonSerializable(typeof(Emulation.SetGeolocationOverrideResult))] internal partial class BiDiJsonSerializerContext : JsonSerializerContext; diff --git a/dotnet/src/webdriver/BiDi/Emulation/EmulationModule.cs b/dotnet/src/webdriver/BiDi/Emulation/EmulationModule.cs index 05558790930f2..6be60f7769c60 100644 --- a/dotnet/src/webdriver/BiDi/Emulation/EmulationModule.cs +++ b/dotnet/src/webdriver/BiDi/Emulation/EmulationModule.cs @@ -24,68 +24,68 @@ namespace OpenQA.Selenium.BiDi.Emulation; public sealed class EmulationModule : Module { - public async Task SetTimezoneOverrideAsync(string? timezone, SetTimezoneOverrideOptions? options = null) + public async Task SetTimezoneOverrideAsync(string? timezone, SetTimezoneOverrideOptions? options = null) { var @params = new SetTimezoneOverrideParameters(timezone, options?.Contexts, options?.UserContexts); - return await Broker.ExecuteCommandAsync(new SetTimezoneOverrideCommand(@params), options, JsonContext.SetTimezoneOverrideCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new SetTimezoneOverrideCommand(@params), options, JsonContext.SetTimezoneOverrideCommand, JsonContext.SetTimezoneOverrideResult).ConfigureAwait(false); } - public async Task SetUserAgentOverrideAsync(string? userAgent, SetUserAgentOverrideOptions? options = null) + public async Task SetUserAgentOverrideAsync(string? userAgent, SetUserAgentOverrideOptions? options = null) { var @params = new SetUserAgentOverrideParameters(userAgent, options?.Contexts, options?.UserContexts); - return await Broker.ExecuteCommandAsync(new SetUserAgentOverrideCommand(@params), options, JsonContext.SetUserAgentOverrideCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new SetUserAgentOverrideCommand(@params), options, JsonContext.SetUserAgentOverrideCommand, JsonContext.SetUserAgentOverrideResult).ConfigureAwait(false); } - public async Task SetLocaleOverrideAsync(string? locale, SetLocaleOverrideOptions? options = null) + public async Task SetLocaleOverrideAsync(string? locale, SetLocaleOverrideOptions? options = null) { var @params = new SetLocaleOverrideParameters(locale, options?.Contexts, options?.UserContexts); - return await Broker.ExecuteCommandAsync(new SetLocaleOverrideCommand(@params), options, JsonContext.SetLocaleOverrideCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new SetLocaleOverrideCommand(@params), options, JsonContext.SetLocaleOverrideCommand, JsonContext.SetLocaleOverrideResult).ConfigureAwait(false); } - public async Task SetForcedColorsModeThemeOverrideAsync(ForcedColorsModeTheme? theme, SetForcedColorsModeThemeOverrideOptions? options = null) + public async Task SetForcedColorsModeThemeOverrideAsync(ForcedColorsModeTheme? theme, SetForcedColorsModeThemeOverrideOptions? options = null) { var @params = new SetForcedColorsModeThemeOverrideParameters(theme, options?.Contexts, options?.UserContexts); - return await Broker.ExecuteCommandAsync(new SetForcedColorsModeThemeOverrideCommand(@params), options, JsonContext.SetForcedColorsModeThemeOverrideCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new SetForcedColorsModeThemeOverrideCommand(@params), options, JsonContext.SetForcedColorsModeThemeOverrideCommand, JsonContext.SetForcedColorsModeThemeOverrideResult).ConfigureAwait(false); } - public async Task SetScriptingEnabledAsync(bool? enabled, SetScriptingEnabledOptions? options = null) + public async Task SetScriptingEnabledAsync(bool? enabled, SetScriptingEnabledOptions? options = null) { var @params = new SetScriptingEnabledParameters(enabled, options?.Contexts, options?.UserContexts); - return await Broker.ExecuteCommandAsync(new SetScriptingEnabledCommand(@params), options, JsonContext.SetScriptingEnabledCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new SetScriptingEnabledCommand(@params), options, JsonContext.SetScriptingEnabledCommand, JsonContext.SetScriptingEnabledResult).ConfigureAwait(false); } - public async Task SetScreenOrientationOverrideAsync(ScreenOrientation? screenOrientation, SetScreenOrientationOverrideOptions? options = null) + public async Task SetScreenOrientationOverrideAsync(ScreenOrientation? screenOrientation, SetScreenOrientationOverrideOptions? options = null) { var @params = new SetScreenOrientationOverrideParameters(screenOrientation, options?.Contexts, options?.UserContexts); - return await Broker.ExecuteCommandAsync(new SetScreenOrientationOverrideCommand(@params), options, JsonContext.SetScreenOrientationOverrideCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new SetScreenOrientationOverrideCommand(@params), options, JsonContext.SetScreenOrientationOverrideCommand, JsonContext.SetScreenOrientationOverrideResult).ConfigureAwait(false); } - public async Task SetGeolocationCoordinatesOverrideAsync(double latitude, double longitude, SetGeolocationCoordinatesOverrideOptions? options = null) + public async Task SetGeolocationCoordinatesOverrideAsync(double latitude, double longitude, SetGeolocationCoordinatesOverrideOptions? options = null) { var coordinates = new GeolocationCoordinates(latitude, longitude, options?.Accuracy, options?.Altitude, options?.AltitudeAccuracy, options?.Heading, options?.Speed); var @params = new SetGeolocationOverrideCoordinatesParameters(coordinates, options?.Contexts, options?.UserContexts); - return await Broker.ExecuteCommandAsync(new SetGeolocationOverrideCommand(@params), options, JsonContext.SetGeolocationOverrideCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new SetGeolocationOverrideCommand(@params), options, JsonContext.SetGeolocationOverrideCommand, JsonContext.SetGeolocationOverrideResult).ConfigureAwait(false); } - public async Task SetGeolocationCoordinatesOverrideAsync(SetGeolocationOverrideOptions? options = null) + public async Task SetGeolocationCoordinatesOverrideAsync(SetGeolocationOverrideOptions? options = null) { var @params = new SetGeolocationOverrideCoordinatesParameters(null, options?.Contexts, options?.UserContexts); - return await Broker.ExecuteCommandAsync(new SetGeolocationOverrideCommand(@params), options, JsonContext.SetGeolocationOverrideCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new SetGeolocationOverrideCommand(@params), options, JsonContext.SetGeolocationOverrideCommand, JsonContext.SetGeolocationOverrideResult).ConfigureAwait(false); } - public async Task SetGeolocationPositionErrorOverrideAsync(SetGeolocationPositionErrorOverrideOptions? options = null) + public async Task SetGeolocationPositionErrorOverrideAsync(SetGeolocationPositionErrorOverrideOptions? options = null) { var @params = new SetGeolocationOverridePositionErrorParameters(new GeolocationPositionError(), options?.Contexts, options?.UserContexts); - return await Broker.ExecuteCommandAsync(new SetGeolocationOverrideCommand(@params), options, JsonContext.SetGeolocationOverrideCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new SetGeolocationOverrideCommand(@params), options, JsonContext.SetGeolocationOverrideCommand, JsonContext.SetGeolocationOverrideResult).ConfigureAwait(false); } } diff --git a/dotnet/src/webdriver/BiDi/Emulation/SetForcedColorsModeThemeOverrideCommand.cs b/dotnet/src/webdriver/BiDi/Emulation/SetForcedColorsModeThemeOverrideCommand.cs index 732eabb370387..b1b359995b2be 100644 --- a/dotnet/src/webdriver/BiDi/Emulation/SetForcedColorsModeThemeOverrideCommand.cs +++ b/dotnet/src/webdriver/BiDi/Emulation/SetForcedColorsModeThemeOverrideCommand.cs @@ -25,7 +25,7 @@ namespace OpenQA.Selenium.BiDi.Emulation; internal sealed class SetForcedColorsModeThemeOverrideCommand(SetForcedColorsModeThemeOverrideParameters @params) - : Command(@params, "emulation.setForcedColorsModeThemeOverride"); + : Command(@params, "emulation.setForcedColorsModeThemeOverride"); internal sealed record SetForcedColorsModeThemeOverrideParameters([property: JsonIgnore(Condition = JsonIgnoreCondition.Never)] ForcedColorsModeTheme? Theme, IEnumerable? Contexts, IEnumerable? UserContexts) : Parameters; @@ -42,3 +42,5 @@ public enum ForcedColorsModeTheme Light, Dark } + +public sealed record SetForcedColorsModeThemeOverrideResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Emulation/SetGeolocationOverrideCommand.cs b/dotnet/src/webdriver/BiDi/Emulation/SetGeolocationOverrideCommand.cs index 00ff55da79319..2054bc1d95113 100644 --- a/dotnet/src/webdriver/BiDi/Emulation/SetGeolocationOverrideCommand.cs +++ b/dotnet/src/webdriver/BiDi/Emulation/SetGeolocationOverrideCommand.cs @@ -24,7 +24,7 @@ namespace OpenQA.Selenium.BiDi.Emulation; internal sealed class SetGeolocationOverrideCommand(SetGeolocationOverrideParameters @params) - : Command(@params, "emulation.setGeolocationOverride"); + : Command(@params, "emulation.setGeolocationOverride"); [JsonDerivedType(typeof(SetGeolocationOverrideCoordinatesParameters))] [JsonDerivedType(typeof(SetGeolocationOverridePositionErrorParameters))] @@ -59,3 +59,5 @@ public sealed class SetGeolocationCoordinatesOverrideOptions : SetGeolocationOve } public sealed class SetGeolocationPositionErrorOverrideOptions : SetGeolocationOverrideOptions; + +public sealed record SetGeolocationOverrideResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Emulation/SetLocaleOverrideCommand.cs b/dotnet/src/webdriver/BiDi/Emulation/SetLocaleOverrideCommand.cs index 900178c9090e1..55373fb557594 100644 --- a/dotnet/src/webdriver/BiDi/Emulation/SetLocaleOverrideCommand.cs +++ b/dotnet/src/webdriver/BiDi/Emulation/SetLocaleOverrideCommand.cs @@ -24,7 +24,7 @@ namespace OpenQA.Selenium.BiDi.Emulation; internal sealed class SetLocaleOverrideCommand(SetLocaleOverrideParameters @params) - : Command(@params, "emulation.setLocaleOverride"); + : Command(@params, "emulation.setLocaleOverride"); internal sealed record SetLocaleOverrideParameters([property: JsonIgnore(Condition = JsonIgnoreCondition.Never)] string? Locale, IEnumerable? Contexts, IEnumerable? UserContexts) : Parameters; @@ -34,3 +34,5 @@ public sealed class SetLocaleOverrideOptions : CommandOptions public IEnumerable? UserContexts { get; set; } } + +public sealed record SetLocaleOverrideResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Emulation/SetScreenOrientationOverrideCommand.cs b/dotnet/src/webdriver/BiDi/Emulation/SetScreenOrientationOverrideCommand.cs index 1b0a10409bd9b..cd30977fea772 100644 --- a/dotnet/src/webdriver/BiDi/Emulation/SetScreenOrientationOverrideCommand.cs +++ b/dotnet/src/webdriver/BiDi/Emulation/SetScreenOrientationOverrideCommand.cs @@ -25,7 +25,7 @@ namespace OpenQA.Selenium.BiDi.Emulation; internal sealed class SetScreenOrientationOverrideCommand(SetScreenOrientationOverrideParameters @params) - : Command(@params, "emulation.setScreenOrientationOverride"); + : Command(@params, "emulation.setScreenOrientationOverride"); internal sealed record SetScreenOrientationOverrideParameters([property: JsonIgnore(Condition = JsonIgnoreCondition.Never)] ScreenOrientation? ScreenOrientation, IEnumerable? Contexts, IEnumerable? UserContexts) : Parameters; @@ -53,3 +53,5 @@ public enum ScreenOrientationType } public sealed record ScreenOrientation(ScreenOrientationNatural Natural, ScreenOrientationType Type); + +public sealed record SetScreenOrientationOverrideResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Emulation/SetScriptingEnabledCommand.cs b/dotnet/src/webdriver/BiDi/Emulation/SetScriptingEnabledCommand.cs index d19a9dfa4bf90..d4155167a61ef 100644 --- a/dotnet/src/webdriver/BiDi/Emulation/SetScriptingEnabledCommand.cs +++ b/dotnet/src/webdriver/BiDi/Emulation/SetScriptingEnabledCommand.cs @@ -24,7 +24,7 @@ namespace OpenQA.Selenium.BiDi.Emulation; internal sealed class SetScriptingEnabledCommand(SetScriptingEnabledParameters @params) - : Command(@params, "emulation.setScriptingEnabled"); + : Command(@params, "emulation.setScriptingEnabled"); internal sealed record SetScriptingEnabledParameters([property: JsonIgnore(Condition = JsonIgnoreCondition.Never)] bool? Enabled, IEnumerable? Contexts, IEnumerable? UserContexts) : Parameters; @@ -34,3 +34,5 @@ public sealed class SetScriptingEnabledOptions : CommandOptions public IEnumerable? UserContexts { get; set; } } + +public sealed record SetScriptingEnabledResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Emulation/SetTimezoneOverrideCommand.cs b/dotnet/src/webdriver/BiDi/Emulation/SetTimezoneOverrideCommand.cs index a3c24c25ff530..aecb19b29774d 100644 --- a/dotnet/src/webdriver/BiDi/Emulation/SetTimezoneOverrideCommand.cs +++ b/dotnet/src/webdriver/BiDi/Emulation/SetTimezoneOverrideCommand.cs @@ -24,7 +24,7 @@ namespace OpenQA.Selenium.BiDi.Emulation; internal sealed class SetTimezoneOverrideCommand(SetTimezoneOverrideParameters @params) - : Command(@params, "emulation.setTimezoneOverride"); + : Command(@params, "emulation.setTimezoneOverride"); internal sealed record SetTimezoneOverrideParameters([property: JsonIgnore(Condition = JsonIgnoreCondition.Never)] string? Timezone, IEnumerable? Contexts, IEnumerable? UserContexts) : Parameters; @@ -34,3 +34,5 @@ public sealed class SetTimezoneOverrideOptions : CommandOptions public IEnumerable? UserContexts { get; set; } } + +public sealed record SetTimezoneOverrideResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Emulation/SetUserAgentOverrideCommand.cs b/dotnet/src/webdriver/BiDi/Emulation/SetUserAgentOverrideCommand.cs index 69467d6d5f9db..c9f12e7ef28df 100644 --- a/dotnet/src/webdriver/BiDi/Emulation/SetUserAgentOverrideCommand.cs +++ b/dotnet/src/webdriver/BiDi/Emulation/SetUserAgentOverrideCommand.cs @@ -24,7 +24,7 @@ namespace OpenQA.Selenium.BiDi.Emulation; internal sealed class SetUserAgentOverrideCommand(SetUserAgentOverrideParameters @params) - : Command(@params, "emulation.setUserAgentOverride"); + : Command(@params, "emulation.setUserAgentOverride"); internal sealed record SetUserAgentOverrideParameters([property: JsonIgnore(Condition = JsonIgnoreCondition.Never)] string? UserAgent, IEnumerable? Contexts, IEnumerable? UserContexts) : Parameters; @@ -34,3 +34,5 @@ public sealed class SetUserAgentOverrideOptions : CommandOptions public IEnumerable? UserContexts { get; set; } } + +public sealed record SetUserAgentOverrideResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Input/InputModule.cs b/dotnet/src/webdriver/BiDi/Input/InputModule.cs index b1653167e288e..8d2662caa035a 100644 --- a/dotnet/src/webdriver/BiDi/Input/InputModule.cs +++ b/dotnet/src/webdriver/BiDi/Input/InputModule.cs @@ -25,24 +25,24 @@ namespace OpenQA.Selenium.BiDi.Input; public sealed class InputModule : Module { - public async Task PerformActionsAsync(BrowsingContext.BrowsingContext context, IEnumerable actions, PerformActionsOptions? options = null) + public async Task PerformActionsAsync(BrowsingContext.BrowsingContext context, IEnumerable actions, PerformActionsOptions? options = null) { var @params = new PerformActionsParameters(context, actions); - return await Broker.ExecuteCommandAsync(new PerformActionsCommand(@params), options, JsonContext.PerformActionsCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new PerformActionsCommand(@params), options, JsonContext.PerformActionsCommand, JsonContext.PerformActionsResult).ConfigureAwait(false); } - public async Task ReleaseActionsAsync(BrowsingContext.BrowsingContext context, ReleaseActionsOptions? options = null) + public async Task ReleaseActionsAsync(BrowsingContext.BrowsingContext context, ReleaseActionsOptions? options = null) { var @params = new ReleaseActionsParameters(context); - return await Broker.ExecuteCommandAsync(new ReleaseActionsCommand(@params), options, JsonContext.ReleaseActionsCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new ReleaseActionsCommand(@params), options, JsonContext.ReleaseActionsCommand, JsonContext.ReleaseActionsResult).ConfigureAwait(false); } - public async Task SetFilesAsync(BrowsingContext.BrowsingContext context, Script.ISharedReference element, IEnumerable files, SetFilesOptions? options = null) + public async Task SetFilesAsync(BrowsingContext.BrowsingContext context, Script.ISharedReference element, IEnumerable files, SetFilesOptions? options = null) { var @params = new SetFilesParameters(context, element, files); - return await Broker.ExecuteCommandAsync(new SetFilesCommand(@params), options, JsonContext.SetFilesCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new SetFilesCommand(@params), options, JsonContext.SetFilesCommand, JsonContext.SetFilesResult).ConfigureAwait(false); } } diff --git a/dotnet/src/webdriver/BiDi/Input/PerformActionsCommand.cs b/dotnet/src/webdriver/BiDi/Input/PerformActionsCommand.cs index 4ea5ba83ebfc9..92b751be69213 100644 --- a/dotnet/src/webdriver/BiDi/Input/PerformActionsCommand.cs +++ b/dotnet/src/webdriver/BiDi/Input/PerformActionsCommand.cs @@ -23,8 +23,10 @@ namespace OpenQA.Selenium.BiDi.Input; internal sealed class PerformActionsCommand(PerformActionsParameters @params) - : Command(@params, "input.performActions"); + : Command(@params, "input.performActions"); internal sealed record PerformActionsParameters(BrowsingContext.BrowsingContext Context, IEnumerable Actions) : Parameters; public sealed class PerformActionsOptions : CommandOptions; + +public sealed record PerformActionsResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Input/ReleaseActionsCommand.cs b/dotnet/src/webdriver/BiDi/Input/ReleaseActionsCommand.cs index 3228645ff0726..b55cdef462ddd 100644 --- a/dotnet/src/webdriver/BiDi/Input/ReleaseActionsCommand.cs +++ b/dotnet/src/webdriver/BiDi/Input/ReleaseActionsCommand.cs @@ -22,8 +22,10 @@ namespace OpenQA.Selenium.BiDi.Input; internal sealed class ReleaseActionsCommand(ReleaseActionsParameters @params) - : Command(@params, "input.releaseActions"); + : Command(@params, "input.releaseActions"); internal sealed record ReleaseActionsParameters(BrowsingContext.BrowsingContext Context) : Parameters; public sealed class ReleaseActionsOptions : CommandOptions; + +public sealed record ReleaseActionsResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Input/SetFilesCommand.cs b/dotnet/src/webdriver/BiDi/Input/SetFilesCommand.cs index b695361378e42..3b0736522281d 100644 --- a/dotnet/src/webdriver/BiDi/Input/SetFilesCommand.cs +++ b/dotnet/src/webdriver/BiDi/Input/SetFilesCommand.cs @@ -23,8 +23,10 @@ namespace OpenQA.Selenium.BiDi.Input; internal sealed class SetFilesCommand(SetFilesParameters @params) - : Command(@params, "input.setFiles"); + : Command(@params, "input.setFiles"); internal sealed record SetFilesParameters(BrowsingContext.BrowsingContext Context, Script.ISharedReference Element, IEnumerable Files) : Parameters; public sealed class SetFilesOptions : CommandOptions; + +public sealed record SetFilesResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Network/ContinueRequestCommand.cs b/dotnet/src/webdriver/BiDi/Network/ContinueRequestCommand.cs index c31d7eb6a7392..812256f6e6977 100644 --- a/dotnet/src/webdriver/BiDi/Network/ContinueRequestCommand.cs +++ b/dotnet/src/webdriver/BiDi/Network/ContinueRequestCommand.cs @@ -23,7 +23,7 @@ namespace OpenQA.Selenium.BiDi.Network; internal sealed class ContinueRequestCommand(ContinueRequestParameters @params) - : Command(@params, "network.continueRequest"); + : Command(@params, "network.continueRequest"); internal sealed record ContinueRequestParameters(Request Request, BytesValue? Body, IEnumerable? Cookies, IEnumerable
? Headers, string? Method, string? Url) : Parameters; @@ -39,3 +39,5 @@ public sealed class ContinueRequestOptions : CommandOptions public string? Url { get; set; } } + +public sealed record ContinueRequestResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Network/ContinueResponseCommand.cs b/dotnet/src/webdriver/BiDi/Network/ContinueResponseCommand.cs index a45199c2f85de..082ccd3e8ceef 100644 --- a/dotnet/src/webdriver/BiDi/Network/ContinueResponseCommand.cs +++ b/dotnet/src/webdriver/BiDi/Network/ContinueResponseCommand.cs @@ -23,7 +23,7 @@ namespace OpenQA.Selenium.BiDi.Network; internal sealed class ContinueResponseCommand(ContinueResponseParameters @params) - : Command(@params, "network.continueResponse"); + : Command(@params, "network.continueResponse"); internal sealed record ContinueResponseParameters(Request Request, IEnumerable? Cookies, IEnumerable? Credentials, IEnumerable
? Headers, string? ReasonPhrase, long? StatusCode) : Parameters; @@ -39,3 +39,5 @@ public sealed class ContinueResponseOptions : CommandOptions public long? StatusCode { get; set; } } + +public sealed record ContinueResponseResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Network/ContinueWithAuthCommand.cs b/dotnet/src/webdriver/BiDi/Network/ContinueWithAuthCommand.cs index 64e985d737a15..cd919cd0d705a 100644 --- a/dotnet/src/webdriver/BiDi/Network/ContinueWithAuthCommand.cs +++ b/dotnet/src/webdriver/BiDi/Network/ContinueWithAuthCommand.cs @@ -23,7 +23,7 @@ namespace OpenQA.Selenium.BiDi.Network; internal class ContinueWithAuthCommand(ContinueWithAuthParameters @params) - : Command(@params, "network.continueWithAuth"); + : Command(@params, "network.continueWithAuth"); [JsonPolymorphic(TypeDiscriminatorPropertyName = "action")] [JsonDerivedType(typeof(ContinueWithAuthCredentials), "provideCredentials")] @@ -49,3 +49,4 @@ public sealed class ContinueWithAuthDefaultCredentialsOptions : ContinueWithAuth public sealed class ContinueWithAuthCancelCredentialsOptions : ContinueWithAuthNoCredentialsOptions; +public sealed record ContinueWithAuthResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Network/FailRequestCommand.cs b/dotnet/src/webdriver/BiDi/Network/FailRequestCommand.cs index 9e1efc8c0a37e..51a5ab5bd62f8 100644 --- a/dotnet/src/webdriver/BiDi/Network/FailRequestCommand.cs +++ b/dotnet/src/webdriver/BiDi/Network/FailRequestCommand.cs @@ -22,8 +22,10 @@ namespace OpenQA.Selenium.BiDi.Network; internal sealed class FailRequestCommand(FailRequestParameters @params) - : Command(@params, "network.failRequest"); + : Command(@params, "network.failRequest"); internal sealed record FailRequestParameters(Request Request) : Parameters; public sealed class FailRequestOptions : CommandOptions; + +public sealed record FailRequestResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Network/NetworkModule.cs b/dotnet/src/webdriver/BiDi/Network/NetworkModule.cs index ceb132784b13c..4242f8515bab9 100644 --- a/dotnet/src/webdriver/BiDi/Network/NetworkModule.cs +++ b/dotnet/src/webdriver/BiDi/Network/NetworkModule.cs @@ -44,53 +44,53 @@ public async Task AddInterceptAsync(IEnumerable phase return result.Intercept; } - public async Task RemoveDataCollectorAsync(Collector collector, RemoveDataCollectorOptions? options = null) + public async Task RemoveDataCollectorAsync(Collector collector, RemoveDataCollectorOptions? options = null) { var @params = new RemoveDataCollectorParameters(collector); - return await Broker.ExecuteCommandAsync(new RemoveDataCollectorCommand(@params), options, JsonContext.RemoveDataCollectorCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new RemoveDataCollectorCommand(@params), options, JsonContext.RemoveDataCollectorCommand, JsonContext.RemoveDataCollectorResult).ConfigureAwait(false); } - public async Task RemoveInterceptAsync(Intercept intercept, RemoveInterceptOptions? options = null) + public async Task RemoveInterceptAsync(Intercept intercept, RemoveInterceptOptions? options = null) { var @params = new RemoveInterceptParameters(intercept); - return await Broker.ExecuteCommandAsync(new RemoveInterceptCommand(@params), options, JsonContext.RemoveInterceptCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new RemoveInterceptCommand(@params), options, JsonContext.RemoveInterceptCommand, JsonContext.RemoveInterceptResult).ConfigureAwait(false); } - public async Task SetCacheBehaviorAsync(CacheBehavior behavior, SetCacheBehaviorOptions? options = null) + public async Task SetCacheBehaviorAsync(CacheBehavior behavior, SetCacheBehaviorOptions? options = null) { var @params = new SetCacheBehaviorParameters(behavior, options?.Contexts); - return await Broker.ExecuteCommandAsync(new SetCacheBehaviorCommand(@params), options, JsonContext.SetCacheBehaviorCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new SetCacheBehaviorCommand(@params), options, JsonContext.SetCacheBehaviorCommand, JsonContext.SetCacheBehaviorResult).ConfigureAwait(false); } - public async Task SetExtraHeadersAsync(IEnumerable
headers, SetExtraHeadersOptions? options = null) + public async Task SetExtraHeadersAsync(IEnumerable
headers, SetExtraHeadersOptions? options = null) { var @params = new SetExtraHeadersParameters(headers, options?.Contexts, options?.UserContexts); - return await Broker.ExecuteCommandAsync(new SetExtraHeadersCommand(@params), options, JsonContext.SetExtraHeadersCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new SetExtraHeadersCommand(@params), options, JsonContext.SetExtraHeadersCommand, JsonContext.SetExtraHeadersResult).ConfigureAwait(false); } - public async Task ContinueRequestAsync(Request request, ContinueRequestOptions? options = null) + public async Task ContinueRequestAsync(Request request, ContinueRequestOptions? options = null) { var @params = new ContinueRequestParameters(request, options?.Body, options?.Cookies, options?.Headers, options?.Method, options?.Url); - return await Broker.ExecuteCommandAsync(new ContinueRequestCommand(@params), options, JsonContext.ContinueRequestCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new ContinueRequestCommand(@params), options, JsonContext.ContinueRequestCommand, JsonContext.ContinueRequestResult).ConfigureAwait(false); } - public async Task ContinueResponseAsync(Request request, ContinueResponseOptions? options = null) + public async Task ContinueResponseAsync(Request request, ContinueResponseOptions? options = null) { var @params = new ContinueResponseParameters(request, options?.Cookies, options?.Credentials, options?.Headers, options?.ReasonPhrase, options?.StatusCode); - return await Broker.ExecuteCommandAsync(new ContinueResponseCommand(@params), options, JsonContext.ContinueResponseCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new ContinueResponseCommand(@params), options, JsonContext.ContinueResponseCommand, JsonContext.ContinueResponseResult).ConfigureAwait(false); } - public async Task FailRequestAsync(Request request, FailRequestOptions? options = null) + public async Task FailRequestAsync(Request request, FailRequestOptions? options = null) { var @params = new FailRequestParameters(request); - return await Broker.ExecuteCommandAsync(new FailRequestCommand(@params), options, JsonContext.FailRequestCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new FailRequestCommand(@params), options, JsonContext.FailRequestCommand, JsonContext.FailRequestResult).ConfigureAwait(false); } public async Task GetDataAsync(DataType dataType, Request request, GetDataOptions? options = null) @@ -102,26 +102,26 @@ public async Task GetDataAsync(DataType dataType, Request request, G return result.Bytes; } - public async Task ProvideResponseAsync(Request request, ProvideResponseOptions? options = null) + public async Task ProvideResponseAsync(Request request, ProvideResponseOptions? options = null) { var @params = new ProvideResponseParameters(request, options?.Body, options?.Cookies, options?.Headers, options?.ReasonPhrase, options?.StatusCode); - return await Broker.ExecuteCommandAsync(new ProvideResponseCommand(@params), options, JsonContext.ProvideResponseCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new ProvideResponseCommand(@params), options, JsonContext.ProvideResponseCommand, JsonContext.ProvideResponseResult).ConfigureAwait(false); } - public async Task ContinueWithAuthAsync(Request request, AuthCredentials credentials, ContinueWithAuthCredentialsOptions? options = null) + public async Task ContinueWithAuthAsync(Request request, AuthCredentials credentials, ContinueWithAuthCredentialsOptions? options = null) { - return await Broker.ExecuteCommandAsync(new ContinueWithAuthCommand(new ContinueWithAuthCredentials(request, credentials)), options, JsonContext.ContinueWithAuthCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new ContinueWithAuthCommand(new ContinueWithAuthCredentials(request, credentials)), options, JsonContext.ContinueWithAuthCommand, JsonContext.ContinueWithAuthResult).ConfigureAwait(false); } - public async Task ContinueWithAuthAsync(Request request, ContinueWithAuthDefaultCredentialsOptions? options = null) + public async Task ContinueWithAuthAsync(Request request, ContinueWithAuthDefaultCredentialsOptions? options = null) { - return await Broker.ExecuteCommandAsync(new ContinueWithAuthCommand(new ContinueWithAuthDefaultCredentials(request)), options, JsonContext.ContinueWithAuthCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new ContinueWithAuthCommand(new ContinueWithAuthDefaultCredentials(request)), options, JsonContext.ContinueWithAuthCommand, JsonContext.ContinueWithAuthResult).ConfigureAwait(false); } - public async Task ContinueWithAuthAsync(Request request, ContinueWithAuthCancelCredentialsOptions? options = null) + public async Task ContinueWithAuthAsync(Request request, ContinueWithAuthCancelCredentialsOptions? options = null) { - return await Broker.ExecuteCommandAsync(new ContinueWithAuthCommand(new ContinueWithAuthCancelCredentials(request)), options, JsonContext.ContinueWithAuthCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new ContinueWithAuthCommand(new ContinueWithAuthCancelCredentials(request)), options, JsonContext.ContinueWithAuthCommand, JsonContext.ContinueWithAuthResult).ConfigureAwait(false); } public async Task OnBeforeRequestSentAsync(Func handler, SubscriptionOptions? options = null) diff --git a/dotnet/src/webdriver/BiDi/Network/ProvideResponseCommand.cs b/dotnet/src/webdriver/BiDi/Network/ProvideResponseCommand.cs index 290c63339498d..8c49f8ab4d1da 100644 --- a/dotnet/src/webdriver/BiDi/Network/ProvideResponseCommand.cs +++ b/dotnet/src/webdriver/BiDi/Network/ProvideResponseCommand.cs @@ -23,7 +23,7 @@ namespace OpenQA.Selenium.BiDi.Network; internal sealed class ProvideResponseCommand(ProvideResponseParameters @params) - : Command(@params, "network.provideResponse"); + : Command(@params, "network.provideResponse"); internal sealed record ProvideResponseParameters(Request Request, BytesValue? Body, IEnumerable? Cookies, IEnumerable
? Headers, string? ReasonPhrase, long? StatusCode) : Parameters; @@ -39,3 +39,5 @@ public sealed class ProvideResponseOptions : CommandOptions public long? StatusCode { get; set; } } + +public sealed record ProvideResponseResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Network/RemoveDataCollectorCommand.cs b/dotnet/src/webdriver/BiDi/Network/RemoveDataCollectorCommand.cs index 5bb81b557fc8a..4029d632eaf3a 100644 --- a/dotnet/src/webdriver/BiDi/Network/RemoveDataCollectorCommand.cs +++ b/dotnet/src/webdriver/BiDi/Network/RemoveDataCollectorCommand.cs @@ -22,8 +22,10 @@ namespace OpenQA.Selenium.BiDi.Network; internal sealed class RemoveDataCollectorCommand(RemoveDataCollectorParameters @params) - : Command(@params, "network.removeDataCollector"); + : Command(@params, "network.removeDataCollector"); internal sealed record RemoveDataCollectorParameters(Collector Collector) : Parameters; public class RemoveDataCollectorOptions : CommandOptions; + +public sealed record RemoveDataCollectorResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Network/RemoveInterceptCommand.cs b/dotnet/src/webdriver/BiDi/Network/RemoveInterceptCommand.cs index 96eda3c812c1f..1ff416186f44a 100644 --- a/dotnet/src/webdriver/BiDi/Network/RemoveInterceptCommand.cs +++ b/dotnet/src/webdriver/BiDi/Network/RemoveInterceptCommand.cs @@ -22,8 +22,10 @@ namespace OpenQA.Selenium.BiDi.Network; internal sealed class RemoveInterceptCommand(RemoveInterceptParameters @params) - : Command(@params, "network.removeIntercept"); + : Command(@params, "network.removeIntercept"); internal sealed record RemoveInterceptParameters(Intercept Intercept) : Parameters; public class RemoveInterceptOptions : CommandOptions; + +public sealed record RemoveInterceptResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Network/SetCacheBehaviorCommand.cs b/dotnet/src/webdriver/BiDi/Network/SetCacheBehaviorCommand.cs index 4e1e2836be701..0a8b8b44a53e3 100644 --- a/dotnet/src/webdriver/BiDi/Network/SetCacheBehaviorCommand.cs +++ b/dotnet/src/webdriver/BiDi/Network/SetCacheBehaviorCommand.cs @@ -25,7 +25,7 @@ namespace OpenQA.Selenium.BiDi.Network; internal sealed class SetCacheBehaviorCommand(SetCacheBehaviorParameters @params) - : Command(@params, "network.setCacheBehavior"); + : Command(@params, "network.setCacheBehavior"); internal sealed record SetCacheBehaviorParameters(CacheBehavior CacheBehavior, IEnumerable? Contexts) : Parameters; @@ -52,3 +52,5 @@ public enum CacheBehavior Default, Bypass } + +public sealed record SetCacheBehaviorResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Network/SetExtraHeadersCommand.cs b/dotnet/src/webdriver/BiDi/Network/SetExtraHeadersCommand.cs index f0229cfb34fa4..e14d13ce7cb69 100644 --- a/dotnet/src/webdriver/BiDi/Network/SetExtraHeadersCommand.cs +++ b/dotnet/src/webdriver/BiDi/Network/SetExtraHeadersCommand.cs @@ -23,7 +23,7 @@ namespace OpenQA.Selenium.BiDi.Network; internal sealed class SetExtraHeadersCommand(SetExtraHeadersParameters @params) - : Command(@params, "network.setExtraHeaders"); + : Command(@params, "network.setExtraHeaders"); internal sealed record SetExtraHeadersParameters(IEnumerable
Headers, IEnumerable? Contexts, IEnumerable? UserContexts) : Parameters; @@ -33,3 +33,5 @@ public sealed class SetExtraHeadersOptions : CommandOptions public IEnumerable? UserContexts { get; set; } } + +public sealed record SetExtraHeadersResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Script/AddPreloadScriptCommand.cs b/dotnet/src/webdriver/BiDi/Script/AddPreloadScriptCommand.cs index 7f5c7047c50b7..b741c2518cee9 100644 --- a/dotnet/src/webdriver/BiDi/Script/AddPreloadScriptCommand.cs +++ b/dotnet/src/webdriver/BiDi/Script/AddPreloadScriptCommand.cs @@ -51,4 +51,4 @@ public sealed record BrowsingContextAddPreloadScriptOptions public string? Sandbox { get; set; } } -internal sealed record AddPreloadScriptResult(PreloadScript Script) : EmptyResult; +public sealed record AddPreloadScriptResult(PreloadScript Script) : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Script/DisownCommand.cs b/dotnet/src/webdriver/BiDi/Script/DisownCommand.cs index f85c93a9da453..f005c467bcb56 100644 --- a/dotnet/src/webdriver/BiDi/Script/DisownCommand.cs +++ b/dotnet/src/webdriver/BiDi/Script/DisownCommand.cs @@ -23,6 +23,10 @@ namespace OpenQA.Selenium.BiDi.Script; internal sealed class DisownCommand(DisownParameters @params) - : Command(@params, "script.disown"); + : Command(@params, "script.disown"); internal sealed record DisownParameters(IEnumerable Handles, Target Target) : Parameters; + +public sealed class DisownOptions : CommandOptions; + +public sealed record DisownResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Script/RemovePreloadScriptCommand.cs b/dotnet/src/webdriver/BiDi/Script/RemovePreloadScriptCommand.cs index 14858034d7735..14fa1068ac8a9 100644 --- a/dotnet/src/webdriver/BiDi/Script/RemovePreloadScriptCommand.cs +++ b/dotnet/src/webdriver/BiDi/Script/RemovePreloadScriptCommand.cs @@ -22,8 +22,10 @@ namespace OpenQA.Selenium.BiDi.Script; internal sealed class RemovePreloadScriptCommand(RemovePreloadScriptParameters @params) - : Command(@params, "script.removePreloadScript"); + : Command(@params, "script.removePreloadScript"); internal sealed record RemovePreloadScriptParameters(PreloadScript Script) : Parameters; public sealed class RemovePreloadScriptOptions : CommandOptions; + +public sealed record RemovePreloadScriptResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Script/ScriptModule.cs b/dotnet/src/webdriver/BiDi/Script/ScriptModule.cs index 3ebd7912638d9..6867941312362 100644 --- a/dotnet/src/webdriver/BiDi/Script/ScriptModule.cs +++ b/dotnet/src/webdriver/BiDi/Script/ScriptModule.cs @@ -19,6 +19,7 @@ using OpenQA.Selenium.BiDi.Communication; using System; +using System.Collections.Generic; using System.Threading.Tasks; namespace OpenQA.Selenium.BiDi.Script; @@ -53,6 +54,13 @@ public async Task CallFunctionAsync(string functionDeclaration, return result.AsSuccessResult().ConvertTo(); } + public async Task DisownAsync(IEnumerable handles, Target target, DisownOptions? options = null) + { + var @params = new DisownParameters(handles, target); + + return await Broker.ExecuteCommandAsync(new DisownCommand(@params), options, JsonContext.DisownCommand, JsonContext.DisownResult).ConfigureAwait(false); + } + public async Task GetRealmsAsync(GetRealmsOptions? options = null) { var @params = new GetRealmsParameters(options?.Context, options?.Type); @@ -60,20 +68,18 @@ public async Task GetRealmsAsync(GetRealmsOptions? options = nu return await Broker.ExecuteCommandAsync(new GetRealmsCommand(@params), options, JsonContext.GetRealmsCommand, JsonContext.GetRealmsResult).ConfigureAwait(false); } - public async Task AddPreloadScriptAsync(string functionDeclaration, AddPreloadScriptOptions? options = null) + public async Task AddPreloadScriptAsync(string functionDeclaration, AddPreloadScriptOptions? options = null) { var @params = new AddPreloadScriptParameters(functionDeclaration, options?.Arguments, options?.Contexts, options?.Sandbox); - var result = await Broker.ExecuteCommandAsync(new AddPreloadScriptCommand(@params), options, JsonContext.AddPreloadScriptCommand, JsonContext.AddPreloadScriptResult).ConfigureAwait(false); - - return result.Script; + return await Broker.ExecuteCommandAsync(new AddPreloadScriptCommand(@params), options, JsonContext.AddPreloadScriptCommand, JsonContext.AddPreloadScriptResult).ConfigureAwait(false); } - public async Task RemovePreloadScriptAsync(PreloadScript script, RemovePreloadScriptOptions? options = null) + public async Task RemovePreloadScriptAsync(PreloadScript script, RemovePreloadScriptOptions? options = null) { var @params = new RemovePreloadScriptParameters(script); - return await Broker.ExecuteCommandAsync(new RemovePreloadScriptCommand(@params), options, JsonContext.RemovePreloadScriptCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new RemovePreloadScriptCommand(@params), options, JsonContext.RemovePreloadScriptCommand, JsonContext.RemovePreloadScriptResult).ConfigureAwait(false); } public async Task OnMessageAsync(Func handler, SubscriptionOptions? options = null) diff --git a/dotnet/src/webdriver/BiDi/Session/EndCommand.cs b/dotnet/src/webdriver/BiDi/Session/EndCommand.cs index 44a481355f143..02001e2fb23f8 100644 --- a/dotnet/src/webdriver/BiDi/Session/EndCommand.cs +++ b/dotnet/src/webdriver/BiDi/Session/EndCommand.cs @@ -22,6 +22,8 @@ namespace OpenQA.Selenium.BiDi.Session; internal sealed class EndCommand() - : Command(Parameters.Empty, "session.end"); + : Command(Parameters.Empty, "session.end"); public sealed class EndOptions : CommandOptions; + +public sealed record EndResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Session/SessionModule.cs b/dotnet/src/webdriver/BiDi/Session/SessionModule.cs index 04d0b6e37a669..b545d51f6d441 100644 --- a/dotnet/src/webdriver/BiDi/Session/SessionModule.cs +++ b/dotnet/src/webdriver/BiDi/Session/SessionModule.cs @@ -37,11 +37,11 @@ public async Task SubscribeAsync(IEnumerable events, Su return await Broker.ExecuteCommandAsync(new(@params), options, JsonContext.SubscribeCommand, JsonContext.SubscribeResult).ConfigureAwait(false); } - public async Task UnsubscribeAsync(IEnumerable subscriptions, UnsubscribeByIdOptions? options = null) + public async Task UnsubscribeAsync(IEnumerable subscriptions, UnsubscribeByIdOptions? options = null) { var @params = new UnsubscribeByIdParameters(subscriptions); - return await Broker.ExecuteCommandAsync(new UnsubscribeByIdCommand(@params), options, JsonContext.UnsubscribeByIdCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new UnsubscribeByIdCommand(@params), options, JsonContext.UnsubscribeByIdCommand, JsonContext.UnsubscribeResult).ConfigureAwait(false); } public async Task NewAsync(CapabilitiesRequest capabilitiesRequest, NewOptions? options = null) @@ -51,8 +51,8 @@ public async Task NewAsync(CapabilitiesRequest capabilitiesRequest, N return await Broker.ExecuteCommandAsync(new NewCommand(@params), options, JsonContext.NewCommand, JsonContext.NewResult).ConfigureAwait(false); } - public async Task EndAsync(EndOptions? options = null) + public async Task EndAsync(EndOptions? options = null) { - return await Broker.ExecuteCommandAsync(new EndCommand(), options, JsonContext.EndCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new EndCommand(), options, JsonContext.EndCommand, JsonContext.EndResult).ConfigureAwait(false); } } diff --git a/dotnet/src/webdriver/BiDi/Session/UnsubscribeCommand.cs b/dotnet/src/webdriver/BiDi/Session/UnsubscribeCommand.cs index 49fe98f5077ab..2978260b266f8 100644 --- a/dotnet/src/webdriver/BiDi/Session/UnsubscribeCommand.cs +++ b/dotnet/src/webdriver/BiDi/Session/UnsubscribeCommand.cs @@ -23,8 +23,10 @@ namespace OpenQA.Selenium.BiDi.Session; internal sealed class UnsubscribeByIdCommand(UnsubscribeByIdParameters @params) - : Command(@params, "session.unsubscribe"); + : Command(@params, "session.unsubscribe"); internal sealed record UnsubscribeByIdParameters(IEnumerable Subscriptions) : Parameters; public sealed class UnsubscribeByIdOptions : CommandOptions; + +public sealed record UnsubscribeResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/WebExtension/UninstallCommand.cs b/dotnet/src/webdriver/BiDi/WebExtension/UninstallCommand.cs index 4d2635293e75c..e28dd8a767c24 100644 --- a/dotnet/src/webdriver/BiDi/WebExtension/UninstallCommand.cs +++ b/dotnet/src/webdriver/BiDi/WebExtension/UninstallCommand.cs @@ -22,8 +22,10 @@ namespace OpenQA.Selenium.BiDi.WebExtension; internal sealed class UninstallCommand(UninstallParameters @params) - : Command(@params, "webExtension.uninstall"); + : Command(@params, "webExtension.uninstall"); internal sealed record UninstallParameters(Extension Extension) : Parameters; public sealed class UninstallOptions : CommandOptions; + +public sealed record UninstallResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/WebExtension/WebExtensionModule.cs b/dotnet/src/webdriver/BiDi/WebExtension/WebExtensionModule.cs index de7a6bca929d3..8432ccc36bd01 100644 --- a/dotnet/src/webdriver/BiDi/WebExtension/WebExtensionModule.cs +++ b/dotnet/src/webdriver/BiDi/WebExtension/WebExtensionModule.cs @@ -31,10 +31,10 @@ public async Task InstallAsync(ExtensionData extensionData, Insta return await Broker.ExecuteCommandAsync(new InstallCommand(@params), options, JsonContext.InstallCommand, JsonContext.InstallResult).ConfigureAwait(false); } - public async Task UninstallAsync(Extension extension, UninstallOptions? options = null) + public async Task UninstallAsync(Extension extension, UninstallOptions? options = null) { var @params = new UninstallParameters(extension); - return await Broker.ExecuteCommandAsync(new UninstallCommand(@params), options, JsonContext.UninstallCommand, JsonContext.EmptyResult).ConfigureAwait(false); + return await Broker.ExecuteCommandAsync(new UninstallCommand(@params), options, JsonContext.UninstallCommand, JsonContext.UninstallResult).ConfigureAwait(false); } } diff --git a/dotnet/test/common/BiDi/Browser/BrowserTest.cs b/dotnet/test/common/BiDi/Browser/BrowserTest.cs index c1c230b993f63..09ac424869d1a 100644 --- a/dotnet/test/common/BiDi/Browser/BrowserTest.cs +++ b/dotnet/test/common/BiDi/Browser/BrowserTest.cs @@ -18,6 +18,7 @@ // using NUnit.Framework; +using System.Linq; using System.Threading.Tasks; namespace OpenQA.Selenium.BiDi.Browser; @@ -38,12 +39,15 @@ public async Task CanGetUserContexts() var userContext1 = await bidi.Browser.CreateUserContextAsync(); var userContext2 = await bidi.Browser.CreateUserContextAsync(); - var userContexts = await bidi.Browser.GetUserContextsAsync(); + var userContextsResult = await bidi.Browser.GetUserContextsAsync(); - Assert.That(userContexts, Is.Not.Null); - Assert.That(userContexts, Has.Count.GreaterThanOrEqualTo(2)); - Assert.That(userContexts, Does.Contain(userContext1)); - Assert.That(userContexts, Does.Contain(userContext2)); + Assert.That(userContextsResult, Is.Not.Null); + Assert.That(userContextsResult, Has.Count.GreaterThanOrEqualTo(2)); + + var userContexts = userContextsResult.Select(uc => uc.UserContext); + + Assert.That(userContexts, Does.Contain(userContext1.UserContext)); + Assert.That(userContexts, Does.Contain(userContext2.UserContext)); } [Test] @@ -54,10 +58,10 @@ public async Task CanRemoveUserContext() await userContext2.UserContext.RemoveAsync(); - var userContexts = await bidi.Browser.GetUserContextsAsync(); + var userContexts = (await bidi.Browser.GetUserContextsAsync()).Select(uc => uc.UserContext); - Assert.That(userContexts, Does.Contain(userContext1)); - Assert.That(userContexts, Does.Not.Contain(userContext2)); + Assert.That(userContexts, Does.Contain(userContext1.UserContext)); + Assert.That(userContexts, Does.Not.Contain(userContext2.UserContext)); } [Test] diff --git a/dotnet/test/common/BiDi/BrowsingContext/BrowsingContextTest.cs b/dotnet/test/common/BiDi/BrowsingContext/BrowsingContextTest.cs index ed10187f7e045..c0ae32fe0a118 100644 --- a/dotnet/test/common/BiDi/BrowsingContext/BrowsingContextTest.cs +++ b/dotnet/test/common/BiDi/BrowsingContext/BrowsingContextTest.cs @@ -139,7 +139,7 @@ public async Task CanCloseWindow() { var window = await bidi.BrowsingContext.CreateAsync(ContextType.Window); - await window.CloseAsync(); + await window.Context.CloseAsync(); var tree = await bidi.BrowsingContext.GetTreeAsync(); @@ -151,7 +151,7 @@ public async Task CanCloseTab() { var tab = await bidi.BrowsingContext.CreateAsync(ContextType.Tab); - await tab.CloseAsync(); + await tab.Context.CloseAsync(); var tree = await bidi.BrowsingContext.GetTreeAsync(); diff --git a/dotnet/test/common/BiDi/Script/ScriptCommandsTest.cs b/dotnet/test/common/BiDi/Script/ScriptCommandsTest.cs index ed285fc4b63a4..da751c8d23240 100644 --- a/dotnet/test/common/BiDi/Script/ScriptCommandsTest.cs +++ b/dotnet/test/common/BiDi/Script/ScriptCommandsTest.cs @@ -64,12 +64,12 @@ public async Task CanGetRealmInBrowsingContext() { var tab = await bidi.BrowsingContext.CreateAsync(BrowsingContext.ContextType.Tab); - var realms = await tab.Script.GetRealmsAsync(); + var realms = await tab.Context.Script.GetRealmsAsync(); var tabRealm = realms[0] as WindowRealmInfo; Assert.That(tabRealm, Is.Not.Null); - Assert.That(tabRealm.Context, Is.EqualTo(tab)); + Assert.That(tabRealm.Context, Is.EqualTo(tab.Context)); } [Test] @@ -77,12 +77,12 @@ public async Task CanGetRealmInBrowsingContextByType() { var tab = await bidi.BrowsingContext.CreateAsync(BrowsingContext.ContextType.Tab); - var realms = await tab.Script.GetRealmsAsync(new() { Type = RealmType.Window }); + var realms = await tab.Context.Script.GetRealmsAsync(new() { Type = RealmType.Window }); var tabRealm = realms[0] as WindowRealmInfo; Assert.That(tabRealm, Is.Not.Null); - Assert.That(tabRealm.Context, Is.EqualTo(tab)); + Assert.That(tabRealm.Context, Is.EqualTo(tab.Context)); } [Test] @@ -159,7 +159,7 @@ public async Task CanRemovePreloadedScript() Assert.That(bar, Is.EqualTo(2)); - await preloadScript.RemoveAsync(); + await preloadScript.Script.RemoveAsync(); var resultAfterRemoval = await context.Script.EvaluateAsync("window.bar", true, targetOptions: new() { Sandbox = "sandbox" }); diff --git a/dotnet/test/common/BiDi/Script/ScriptEventsTest.cs b/dotnet/test/common/BiDi/Script/ScriptEventsTest.cs index f17dd0ae62fee..182255a27facf 100644 --- a/dotnet/test/common/BiDi/Script/ScriptEventsTest.cs +++ b/dotnet/test/common/BiDi/Script/ScriptEventsTest.cs @@ -71,7 +71,7 @@ public async Task CanListenToRealmDestroyedEvent() await bidi.Script.OnRealmDestroyedAsync(tcs.SetResult); var ctx = await bidi.BrowsingContext.CreateAsync(BrowsingContext.ContextType.Window); - await ctx.CloseAsync(); + await ctx.Context.CloseAsync(); var args = await tcs.Task.WaitAsync(TimeSpan.FromSeconds(5));