Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion dotnet/src/webdriver/BiDi/BiDi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@ private BiDi() { }

public Emulation.IEmulationModule Emulation => AsModule<Emulation.EmulationModule>();

public static async Task<IBiDi> ConnectAsync(string url, BiDiOptions? options = null, CancellationToken cancellationToken = default)
public static async Task<IBiDi> ConnectAsync(string url, Action<BiDiOptions>? configure = null, CancellationToken cancellationToken = default)
{
Comment thread
nvborisenko marked this conversation as resolved.
Outdated
BiDiOptions options = new();
configure?.Invoke(options);

Comment thread
nvborisenko marked this conversation as resolved.
Outdated
var transport = await WebSocketTransport.ConnectAsync(new Uri(url), cancellationToken).ConfigureAwait(false);

BiDi bidi = new();
Expand Down
4 changes: 2 additions & 2 deletions dotnet/src/webdriver/BiDi/WebDriver.Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace OpenQA.Selenium.BiDi;

public static class WebDriverExtensions
{
Comment thread
nvborisenko marked this conversation as resolved.
public static async Task<IBiDi> AsBiDiAsync(this IWebDriver webDriver, BiDiOptions? options = null, CancellationToken cancellationToken = default)
public static async Task<IBiDi> AsBiDiAsync(this IWebDriver webDriver, Action<BiDiOptions>? configure = null, CancellationToken cancellationToken = default)
Comment thread
nvborisenko marked this conversation as resolved.
Outdated
{
if (webDriver is null) throw new ArgumentNullException(nameof(webDriver));

Expand All @@ -34,7 +34,7 @@ public static async Task<IBiDi> AsBiDiAsync(this IWebDriver webDriver, BiDiOptio

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

var bidi = await BiDi.ConnectAsync(webSocketUrl, options, cancellationToken).ConfigureAwait(false);
var bidi = await BiDi.ConnectAsync(webSocketUrl, configure, cancellationToken).ConfigureAwait(false);

return bidi;
}
Expand Down
Loading