public void Start()
{
this.driverServiceProcess = new Process();
this.driverServiceProcess.StartInfo.FileName = this.driverServicePath;
this.driverServiceProcess.StartInfo.Arguments = string.Format(CultureInfo.InvariantCulture, "--port={0}", this.driverServicePort);
this.driverServiceProcess.StartInfo.UseShellExecute = false;
this.driverServiceProcess.Start();
DateTime timeout = DateTime.Now.Add(TimeSpan.FromSeconds(20));
Uri serviceHealthUri = new Uri(this.serviceUrl, new Uri("healthz", UriKind.Relative));
HttpWebRequest request = HttpWebRequest.Create(serviceHealthUri) as HttpWebRequest;
bool processStarted = false;
while (!processStarted && DateTime.Now < timeout)
{
try
{
request.GetResponse();
processStarted = true;
}
catch (WebException)
{
}
}
}