Skip to content

Commit a667cd0

Browse files
committed
Adding support for whitelisted-ips argument for Chrome and IE driver exes
1 parent 008d9bf commit a667cd0

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

dotnet/src/webdriver/Chrome/ChromeDriverService.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public sealed class ChromeDriverService : DriverService
3535
private string logPath = string.Empty;
3636
private string urlPathPrefix = string.Empty;
3737
private string portServerAddress = string.Empty;
38+
private string whitelistedIpAddresses = string.Empty;
3839
private int adbPort = -1;
3940
private bool enableVerboseLogging;
4041

@@ -95,6 +96,17 @@ public bool EnableVerboseLogging
9596
set { this.enableVerboseLogging = value; }
9697
}
9798

99+
/// <summary>
100+
/// Gets or sets the comma-delimited list of IP addresses that are approved to
101+
/// connect to this instance of the Chrome driver. Defaults to an empty string,
102+
/// which means only the local loopback address can connect.
103+
/// </summary>
104+
public string WhitelistedIPAddresses
105+
{
106+
get { return this.whitelistedIpAddresses; }
107+
set { this.whitelistedIpAddresses = value; }
108+
}
109+
98110
/// <summary>
99111
/// Gets the command-line arguments for the driver service.
100112
/// </summary>
@@ -133,6 +145,11 @@ protected override string CommandLineArguments
133145
argsBuilder.AppendFormat(CultureInfo.InvariantCulture, " --port-server={0}", this.portServerAddress);
134146
}
135147

148+
if (!string.IsNullOrEmpty(this.whitelistedIpAddresses))
149+
{
150+
argsBuilder.Append(string.Format(CultureInfo.InvariantCulture, " -whitelisted-ips={0}", this.whitelistedIpAddresses));
151+
}
152+
136153
return argsBuilder.ToString();
137154
}
138155
}

dotnet/src/webdriver/IE/InternetExplorerDriverService.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public sealed class InternetExplorerDriverService : DriverService
3838
private string host = string.Empty;
3939
private string logFile = string.Empty;
4040
private string libraryExtractionPath = string.Empty;
41+
private string whitelistedIpAddresses = string.Empty;
4142

4243
/// <summary>
4344
/// Initializes a new instance of the <see cref="InternetExplorerDriverService"/> class.
@@ -101,6 +102,17 @@ public string LibraryExtractionPath
101102
set { this.libraryExtractionPath = value; }
102103
}
103104

105+
/// <summary>
106+
/// Gets or sets the comma-delimited list of IP addresses that are approved to
107+
/// connect to this instance of the IEDriverServer. Defaults to an empty string,
108+
/// which means only the local loopback address can connect.
109+
/// </summary>
110+
public string WhitelistedIPAddresses
111+
{
112+
get { return this.whitelistedIpAddresses; }
113+
set { this.whitelistedIpAddresses = value; }
114+
}
115+
104116
/// <summary>
105117
/// Gets the command-line arguments for the driver service.
106118
/// </summary>
@@ -134,6 +146,11 @@ protected override string CommandLineArguments
134146
argsBuilder.Append(string.Format(CultureInfo.InvariantCulture, " -implementation={0}", this.engineImplementation.ToString().ToUpperInvariant()));
135147
}
136148

149+
if (!string.IsNullOrEmpty(this.whitelistedIpAddresses))
150+
{
151+
argsBuilder.Append(string.Format(CultureInfo.InvariantCulture, " -whitelisted-ips={0}", this.whitelistedIpAddresses));
152+
}
153+
137154
if (this.SuppressInitialDiagnosticInformation)
138155
{
139156
argsBuilder.Append(" -silent");

0 commit comments

Comments
 (0)