From 09ae1960f3b90bb95913f1b83f5aef5c1a8de183 Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Sun, 25 May 2025 13:55:51 +0300 Subject: [PATCH] [dotnet] [bidi] Add AcceptInsecureCerts and Proxy options when create new user context --- .../webdriver/BiDi/Modules/Browser/BrowserModule.cs | 5 +++-- .../Modules/Browser/CreateUserContextCommand.cs | 13 ++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/dotnet/src/webdriver/BiDi/Modules/Browser/BrowserModule.cs b/dotnet/src/webdriver/BiDi/Modules/Browser/BrowserModule.cs index 822fbe26ae33d..fe6b939eb6292 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Browser/BrowserModule.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Browser/BrowserModule.cs @@ -17,7 +17,6 @@ // under the License. // -using System.Collections.Generic; using System.Threading.Tasks; using OpenQA.Selenium.BiDi.Communication; @@ -32,7 +31,9 @@ public async Task CloseAsync(CloseOptions? options = null) public async Task CreateUserContextAsync(CreateUserContextOptions? options = null) { - return await Broker.ExecuteCommandAsync(new CreateUserContextCommand(), options).ConfigureAwait(false); + var @params = new CreateUserContextCommandParameters(options?.AcceptInsecureCerts, options?.Proxy); + + return await Broker.ExecuteCommandAsync(new CreateUserContextCommand(@params), options).ConfigureAwait(false); } public async Task GetUserContextsAsync(GetUserContextsOptions? options = null) diff --git a/dotnet/src/webdriver/BiDi/Modules/Browser/CreateUserContextCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Browser/CreateUserContextCommand.cs index f847168ebd9f4..fb695faa9d248 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Browser/CreateUserContextCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Browser/CreateUserContextCommand.cs @@ -21,7 +21,14 @@ namespace OpenQA.Selenium.BiDi.Modules.Browser; -internal class CreateUserContextCommand() - : Command(CommandParameters.Empty, "browser.createUserContext"); +internal class CreateUserContextCommand(CreateUserContextCommandParameters @params) + : Command(@params, "browser.createUserContext"); -public record CreateUserContextOptions : CommandOptions; +internal record CreateUserContextCommandParameters(bool? AcceptInsecureCerts, Session.ProxyConfiguration? Proxy) : CommandParameters; + +public record CreateUserContextOptions : CommandOptions +{ + public bool? AcceptInsecureCerts { get; set; } + + public Session.ProxyConfiguration? Proxy { get; set; } +}