Skip to content

Commit cb1c3f4

Browse files
authored
[dotnet] [bidi] Add AcceptInsecureCerts and Proxy options when create new user context (#15795)
1 parent 09a4b24 commit cb1c3f4

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

dotnet/src/webdriver/BiDi/Modules/Browser/BrowserModule.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
// under the License.
1818
// </copyright>
1919

20-
using System.Collections.Generic;
2120
using System.Threading.Tasks;
2221
using OpenQA.Selenium.BiDi.Communication;
2322

@@ -32,7 +31,9 @@ public async Task CloseAsync(CloseOptions? options = null)
3231

3332
public async Task<UserContextInfo> CreateUserContextAsync(CreateUserContextOptions? options = null)
3433
{
35-
return await Broker.ExecuteCommandAsync<CreateUserContextCommand, UserContextInfo>(new CreateUserContextCommand(), options).ConfigureAwait(false);
34+
var @params = new CreateUserContextCommandParameters(options?.AcceptInsecureCerts, options?.Proxy);
35+
36+
return await Broker.ExecuteCommandAsync<CreateUserContextCommand, UserContextInfo>(new CreateUserContextCommand(@params), options).ConfigureAwait(false);
3637
}
3738

3839
public async Task<GetUserContextsResult> GetUserContextsAsync(GetUserContextsOptions? options = null)

dotnet/src/webdriver/BiDi/Modules/Browser/CreateUserContextCommand.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,14 @@
2121

2222
namespace OpenQA.Selenium.BiDi.Modules.Browser;
2323

24-
internal class CreateUserContextCommand()
25-
: Command<CommandParameters, UserContextInfo>(CommandParameters.Empty, "browser.createUserContext");
24+
internal class CreateUserContextCommand(CreateUserContextCommandParameters @params)
25+
: Command<CreateUserContextCommandParameters, UserContextInfo>(@params, "browser.createUserContext");
2626

27-
public record CreateUserContextOptions : CommandOptions;
27+
internal record CreateUserContextCommandParameters(bool? AcceptInsecureCerts, Session.ProxyConfiguration? Proxy) : CommandParameters;
28+
29+
public record CreateUserContextOptions : CommandOptions
30+
{
31+
public bool? AcceptInsecureCerts { get; set; }
32+
33+
public Session.ProxyConfiguration? Proxy { get; set; }
34+
}

0 commit comments

Comments
 (0)