Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions dotnet/src/webdriver/DriverService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,13 @@ public int ProcessId
/// </summary>
public string? DriverServicePath { get; set; }

/// <summary>
/// Gets or sets a value indicating whether the driver process console output should be logged
/// to the console. Defaults to <see langword="false"/>, meaning console output from the
/// driver will be suppressed.
/// </summary>
public bool LogToConsole { get; set; }

/// <summary>
/// Gets the command-line arguments for the driver service.
/// </summary>
Expand Down Expand Up @@ -243,6 +250,12 @@ public void Start()
this.driverServiceProcess.StartInfo.UseShellExecute = false;
this.driverServiceProcess.StartInfo.CreateNoWindow = this.HideCommandPromptWindow;

if (!this.LogToConsole)
{
this.driverServiceProcess.StartInfo.RedirectStandardOutput = true;
this.driverServiceProcess.StartInfo.RedirectStandardError = true;
}

DriverProcessStartingEventArgs eventArgs = new DriverProcessStartingEventArgs(this.driverServiceProcess.StartInfo);
this.OnDriverProcessStarting(eventArgs);

Expand Down
10 changes: 7 additions & 3 deletions dotnet/src/webdriver/Firefox/FirefoxDriverService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,13 @@ protected override void OnDriverProcessStarting(DriverProcessStartingEventArgs e
// Initialize the log writer
logWriter = new StreamWriter(this.LogPath, append: true) { AutoFlush = true };

// Configure process to redirect output
eventArgs.DriverServiceProcessStartInfo.RedirectStandardOutput = true;
eventArgs.DriverServiceProcessStartInfo.RedirectStandardError = true;
// LogToConsole and LogPath are mutually exclusive. LogPath takes precedence.
if (this.LogToConsole)
{
this.LogToConsole = false;
eventArgs.DriverServiceProcessStartInfo.RedirectStandardOutput = true;
eventArgs.DriverServiceProcessStartInfo.RedirectStandardError = true;
}
}

base.OnDriverProcessStarting(eventArgs);
Expand Down