diff --git a/dotnet/src/webdriver/DriverProcessStartedEventArgs.cs b/dotnet/src/webdriver/DriverProcessStartedEventArgs.cs index ec91d7caad19a..094003b3959c4 100644 --- a/dotnet/src/webdriver/DriverProcessStartedEventArgs.cs +++ b/dotnet/src/webdriver/DriverProcessStartedEventArgs.cs @@ -39,8 +39,15 @@ public class DriverProcessStartedEventArgs : EventArgs public DriverProcessStartedEventArgs(Process driverProcess) { this.processId = driverProcess.Id; - this.standardOutputStreamReader = driverProcess.StandardOutput; - this.standardErrorStreamReader = driverProcess.StandardError; + if (driverProcess.StartInfo.RedirectStandardOutput && !driverProcess.StartInfo.UseShellExecute) + { + this.standardOutputStreamReader = driverProcess.StandardOutput; + } + + if (driverProcess.StartInfo.RedirectStandardError && !driverProcess.StartInfo.UseShellExecute) + { + this.standardErrorStreamReader = driverProcess.StandardError; + } } ///