/// <summary> /// Starts the DriverService if it is not already running. /// </summary> public void Start() { if (this.driverServiceProcess != null) { return; } this.driverServiceProcess = new Process(); this.driverServiceProcess.StartInfo.FileName = Path.Combine(this.driverServicePath, this.driverServiceExecutableName); this.driverServiceProcess.StartInfo.Arguments = this.CommandLineArguments; this.driverServiceProcess.StartInfo.UseShellExecute = false; this.driverServiceProcess.StartInfo.CreateNoWindow = this.hideCommandPromptWindow; DriverProcessStartingEventArgs eventArgs = new DriverProcessStartingEventArgs(this.driverServiceProcess.StartInfo); this.OnDriverProcessStarting(eventArgs); this.driverServiceProcess.Start(); bool serviceAvailable = this.WaitForServiceInitialization(); DriverProcessStartedEventArgs processStartedEventArgs = new DriverProcessStartedEventArgs(this.driverServiceProcess); this.OnDriverProcessStarted(processStartedEventArgs); if (!serviceAvailable) { string msg = "Cannot start the driver service on " + this.ServiceUrl; throw new WebDriverException(msg); } }
/// <summary> /// Raises the <see cref="DriverProcessStarted"/> event. /// </summary> /// <param name="eventArgs">A <see cref="DriverProcessStartedEventArgs"/> that contains the event data.</param> protected void OnDriverProcessStarted(DriverProcessStartedEventArgs eventArgs) { if (eventArgs == null) { throw new ArgumentNullException("eventArgs", "eventArgs must not be null"); } if (this.DriverProcessStarted != null) { this.DriverProcessStarted(this, eventArgs); } }