Skip to content

Commit bd0e4ef

Browse files
committed
Providing option to hide command prompt window for driver service executables in .NET bindings
1 parent 339f39a commit bd0e4ef

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

dotnet/src/webdriver/DriverService.cs

+11
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public abstract class DriverService : IDisposable
3838
private string driverServiceExecutableName;
3939
private int driverServicePort;
4040
private bool silent;
41+
private bool hideCommandPromptWindow;
4142
private Process driverServiceProcess;
4243

4344
/// <summary>
@@ -108,6 +109,15 @@ public bool IsRunning
108109
get { return this.driverServiceProcess != null && !this.driverServiceProcess.HasExited; }
109110
}
110111

112+
/// <summary>
113+
/// Gets or sets a value indicating whether the command prompt window of the service should be hidden.
114+
/// </summary>
115+
public bool HideCommandPromptWindow
116+
{
117+
get { return this.hideCommandPromptWindow; }
118+
set { this.hideCommandPromptWindow = value; }
119+
}
120+
111121
/// <summary>
112122
/// Gets the executable file name of the driver service.
113123
/// </summary>
@@ -143,6 +153,7 @@ public void Start()
143153
this.driverServiceProcess.StartInfo.FileName = Path.Combine(this.driverServicePath, this.driverServiceExecutableName);
144154
this.driverServiceProcess.StartInfo.Arguments = this.CommandLineArguments;
145155
this.driverServiceProcess.StartInfo.UseShellExecute = false;
156+
this.driverServiceProcess.StartInfo.CreateNoWindow = this.hideCommandPromptWindow;
146157
this.driverServiceProcess.Start();
147158
Uri serviceHealthUri = new Uri(this.ServiceUrl, new Uri("status", UriKind.Relative));
148159
bool processStarted = false;

0 commit comments

Comments
 (0)