private IWebDriverUpdater GetUpdaterInternal() { IWebDriverUpdater updater = GetUpdater(httpWebRequestFactory, new WebDriverUpdaterOptions() { WebDriverDirectoryPath = webDriverFactoryOptions.WebDriverDirectoryPath }); if (updater is object) { updater.Log += OnLog.Log; updater.DownloadFileProgressChanged += OnDownloadFileProgressChanged; updater.DownloadFileCompleted += OnDownloadFileCompleted; } return(updater); }
private string GetDriverExecutablePathInternal(IWebBrowserInfo webBrowserInfo) { if (!string.IsNullOrWhiteSpace(webDriverOptions.WebDriverExecutablePath)) { return(webDriverOptions.WebDriverExecutablePath); } if (webBrowserInfo is object && webDriverFactoryOptions.AutoUpdateEnabled) { IWebDriverUpdater updater = GetUpdaterInternal(); if (updater is object) { try { IWebDriverInfo webDriverInfo = updater.Update(webBrowserInfo, updaterCancellationTokenSource.Token); if (!string.IsNullOrWhiteSpace(webDriverInfo?.ExecutablePath)) { return(webDriverInfo.ExecutablePath); } } catch (Exception ex) { OnLog.Error(ex.ToString()); if (!webDriverFactoryOptions.IgnoreUpdateErrors) { throw ex; } } } } if (string.IsNullOrWhiteSpace(webDriverFactoryOptions.WebDriverDirectoryPath)) { return(GetWebDriverExecutablePath()); } return(Path.Combine(webDriverFactoryOptions.WebDriverDirectoryPath, GetWebDriverExecutablePath())); }