public void Start()
{
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.Start();
DateTime timeout = DateTime.Now.Add(TimeSpan.FromSeconds(20));
Uri serviceHealthUri = new Uri(this.ServiceUrl, new Uri("status", UriKind.Relative));
HttpWebRequest request = HttpWebRequest.Create(serviceHealthUri) as HttpWebRequest;
bool processStarted = false;
while (!processStarted && DateTime.Now < timeout)
{
try
{
request.GetResponse();
processStarted = true;
}
catch (WebException)
{
}
}
}
private void SetWebDriverToIE() { var driverPath = AppConfiguration.BrowserDirectory + UtilityHelpers._separator + "InternetExplorer" + UtilityHelpers._separator + _ieDir; _service = InternetExplorerDriverService.CreateDefaultService(driverPath); var _settings = new InternetExplorerOptions { IntroduceInstabilityByIgnoringProtectedModeSettings = true, EnableNativeEvents = true, IgnoreZoomLevel = true }; try { _service.Start(); } catch (DriverServiceNotFoundException err) { throw new DriverServiceNotFoundException(err.Message); } _capabilities = DesiredCapabilities.InternetExplorer(); WebDriver = new RemoteWebDriver(_service.ServiceUrl, _capabilities); }