Skip to content

Commit

Permalink
Updating use of command-line args for protocol selection for Edge in …
Browse files Browse the repository at this point in the history
….NET

The UseSpecCompliantProtocol property of the EdgeDriverService object now
is a nullable boolean instead of just a boolean. If the property is
assigned a value (true or false), it will add the appropriate command-line
argument ("--w3c" or "--jwp", respectively) to the executable command
line. Users using versions of MicrosoftWebDriver.exe that do not support
those command-line arguments should leave the property unset (as a null
value).
  • Loading branch information
jimevans committed May 8, 2018
1 parent c179a1b commit 7129729
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions dotnet/src/webdriver/Edge/EdgeDriverService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public sealed class EdgeDriverService : DriverService
private string host;
private string package;
private bool useVerboseLogging;
private bool useSpecCompliantProtocol;
private bool? useSpecCompliantProtocol;

/// <summary>
/// Initializes a new instance of the <see cref="EdgeDriverService"/> class.
Expand Down Expand Up @@ -78,13 +78,14 @@ public bool UseVerboseLogging
/// should use the a protocol dialect compliant with the W3C WebDriver Specification.
/// </summary>
/// <remarks>
/// Setting this property for driver executables matched to versions of
/// Windows before the 2018 Fall Creators Update will result in a the
/// driver executable shutting down without execution, and all commands
/// will fail. Do not set this property unless you are certain your version
/// of the MicrosoftWebDriver.exe supports the --w3c command-line argument.
/// Setting this property to a non-<see langword="null"/> value for driver
/// executables matched to versions of Windows before the 2018 Fall Creators
/// Update will result in a the driver executable shutting down without
/// execution, and all commands will fail. Do not set this property unless
/// you are certain your version of the MicrosoftWebDriver.exe supports the
/// --w3c and --jwp command-line arguments.
/// </remarks>
public bool UseSpecCompliantProtocol
public bool? UseSpecCompliantProtocol
{
get { return this.useSpecCompliantProtocol; }
set { this.useSpecCompliantProtocol = value; }
Expand All @@ -98,7 +99,7 @@ protected override bool HasShutdown
{
get
{
if (this.useSpecCompliantProtocol)
if (this.useSpecCompliantProtocol.HasValue && this.useSpecCompliantProtocol.Value)
{
return false;
}
Expand All @@ -118,7 +119,7 @@ protected override TimeSpan TerminationTimeout
// gets us to the termination point much faster.
get
{
if (this.useSpecCompliantProtocol)
if (this.useSpecCompliantProtocol.HasValue && this.useSpecCompliantProtocol.Value)
{
return TimeSpan.FromMilliseconds(100);
}
Expand Down Expand Up @@ -155,9 +156,16 @@ protected override string CommandLineArguments
argsBuilder.Append(" --silent");
}

if (this.useSpecCompliantProtocol)
if (this.useSpecCompliantProtocol.HasValue)
{
argsBuilder.Append(" --w3c");
if (this.useSpecCompliantProtocol.Value)
{
argsBuilder.Append(" --w3c");
}
else
{
argsBuilder.Append(" --jwp");
}
}

return argsBuilder.ToString();
Expand Down

0 comments on commit 7129729

Please sign in to comment.