Adding additional properties for geckodriver command line in .NET
There are command line options in more recent geckodriver versions that
the FirefoxDriverService didn't understand. This commit adds additional
properties to the service class to enable those command line options.
@@ -37,6 +37,7 @@ public sealed class FirefoxDriverService : DriverService
private int browserCommunicationPort = -1;
private string browserBinaryPath = string.Empty;
private string host = string.Empty;
+ private string browserCommunicationHost = string.Empty;
private FirefoxDriverLogLevel loggingLevel = FirefoxDriverLogLevel.Default;
/// <summary>
@@ -68,6 +69,16 @@ public int BrowserCommunicationPort
set { this.browserCommunicationPort = value; }
}
+ /// <summary>
+ /// Gets or sets the value of the IP address of the host adapter used by the driver
+ /// executable to communicate with the browser.
+ /// </summary>
+ public string BrowserCommunicationHost
+ {
+ get { return this.browserCommunicationHost; }
+ set { this.browserCommunicationHost = value; }
+ }
+
/// <summary>
/// Gets or sets the value of the IP address of the host adapter on which the
/// service should listen for connections.
@@ -98,6 +109,21 @@ public bool OpenBrowserToolbox
set { this.openBrowserToolbox = value; }
}
+ /// <summary>
+ /// Gets or sets the level at which log output is displayed.
+ /// </summary>
+ /// <remarks>
+ /// This is largely equivalent to setting the <see cref="FirefoxOptions.LogLevel"/>
+ /// property, except the log level is set when the driver launches, instead of
+ /// when the browser is launched, meaning that initial driver logging before
+ /// initiation of a session can be controlled.
+ /// </remarks>
+ public FirefoxDriverLogLevel LogLevel
+ {
+ get { return this.loggingLevel; }
+ set { this.loggingLevel = value; }
+ }
+
/// <summary>
/// Gets a value indicating the time to wait for an initial connection before timing out.
/// </summary>
@@ -147,6 +173,11 @@ protected override string CommandLineArguments
argsBuilder.AppendFormat(CultureInfo.InvariantCulture, " --marionette-port {0}", this.browserCommunicationPort);
}
+ if (!string.IsNullOrEmpty(this.browserCommunicationHost))
+ {
+ argsBuilder.AppendFormat(CultureInfo.InvariantCulture, " --marionette-host \"{0}\"", this.host);
+ }
+
if (this.Port > 0)
{
argsBuilder.AppendFormat(CultureInfo.InvariantCulture, " --port {0}", this.Port);
