Skip to content

Commit fe91134

Browse files
committed
[dotnet] Add Bidi-compliant webSocketUrl capability
1 parent 1dacd21 commit fe91134

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

dotnet/src/webdriver/CapabilityType.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,12 @@ public static class CapabilityType
155155
/// </summary>
156156
public static readonly string UseStrictFileInteractability = "strictFileInteractability";
157157

158+
/// <summary>
159+
/// Capability name used to get a value indicating whether to request URL of a WebSocket
160+
/// connection for bidirectional communication with a driver.
161+
/// </summary>
162+
public static readonly string WebSocketUrl = "webSocketUrl";
163+
158164
private static readonly List<string> KnownSpecCompliantCapabilityNames = new List<string>() {
159165
BrowserName,
160166
BrowserVersion,
@@ -165,7 +171,8 @@ public static class CapabilityType
165171
SetWindowRect,
166172
Timeouts,
167173
UnhandledPromptBehavior,
168-
UseStrictFileInteractability
174+
UseStrictFileInteractability,
175+
WebSocketUrl
169176
};
170177

171178
/// <summary>

dotnet/src/webdriver/DriverOptions.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ public abstract class DriverOptions
9999
private string platformName;
100100
private Proxy proxy;
101101
private bool? acceptInsecureCertificates;
102+
private bool? useWebSocketUrl;
102103
private bool useStrictFileInteractability;
103104
private UnhandledPromptBehavior unhandledPromptBehavior = UnhandledPromptBehavior.Default;
104105
private PageLoadStrategy pageLoadStrategy = PageLoadStrategy.Default;
@@ -118,6 +119,7 @@ protected DriverOptions()
118119
this.AddKnownCapabilityName(CapabilityType.UnhandledPromptBehavior, "UnhandledPromptBehavior property");
119120
this.AddKnownCapabilityName(CapabilityType.PageLoadStrategy, "PageLoadStrategy property");
120121
this.AddKnownCapabilityName(CapabilityType.UseStrictFileInteractability, "UseStrictFileInteractability property");
122+
this.AddKnownCapabilityName(CapabilityType.WebSocketUrl, "UseWebSocketUrl property");
121123
}
122124

123125
/// <summary>
@@ -157,6 +159,16 @@ public bool? AcceptInsecureCertificates
157159
set { this.acceptInsecureCertificates = value; }
158160
}
159161

162+
/// <summary>
163+
/// Gets or sets a value indicating whether the driver should request a URL to
164+
/// a WebSocket to be used for bidirectional communication.
165+
/// </summary>
166+
public bool? UseWebSocketUrl
167+
{
168+
get { return this.useWebSocketUrl; }
169+
set { this.useWebSocketUrl = value; }
170+
}
171+
160172
/// <summary>
161173
/// Gets or sets the value for describing how unexpected alerts are to be handled in the browser.
162174
/// Defaults to <see cref="UnhandledPromptBehavior.Default"/>.
@@ -450,6 +462,11 @@ protected IWritableCapabilities GenerateDesiredCapabilities(bool isSpecification
450462
capabilities.SetCapability(CapabilityType.AcceptInsecureCertificates, this.acceptInsecureCertificates);
451463
}
452464

465+
if (this.useWebSocketUrl.HasValue)
466+
{
467+
capabilities.SetCapability(CapabilityType.WebSocketUrl, this.useWebSocketUrl);
468+
}
469+
453470
if (this.useStrictFileInteractability)
454471
{
455472
capabilities.SetCapability(CapabilityType.UseStrictFileInteractability, true);

dotnet/src/webdriver/Remote/DesiredCapabilities.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ namespace OpenQA.Selenium.Remote
2727
/// <summary>
2828
/// Internal class to specify the requested capabilities of the browser for <see cref="IWebDriver"/>.
2929
/// </summary>
30-
[Obsolete("Use of DesiredCapabilities has been deprecated in favor of browser-specific Options classes")]
3130
internal class DesiredCapabilities : IWritableCapabilities, IHasCapabilitiesDictionary
3231
{
3332
private readonly Dictionary<string, object> capabilities = new Dictionary<string, object>();

0 commit comments

Comments
 (0)