private static string GetVersionToDownload(IDriverConfig config, string version) { switch (version) { case VersionResolveStrategy.MatchingBrowser: return(config.GetMatchingBrowserVersion()); case VersionResolveStrategy.Latest: return(config.GetLatestVersion()); default: return(version); } }
private static void SetUpDriver(IDriverConfig driverConfig, IDriverSettings driverSettings) { var architecture = driverSettings.SystemArchitecture.Equals(Architecture.Auto) ? ArchitectureHelper.GetArchitecture() : driverSettings.SystemArchitecture; var version = driverSettings.WebDriverVersion.Equals(VersionResolveStrategy.Latest) ? driverConfig.GetLatestVersion() : driverSettings.WebDriverVersion; version = version.Equals(VersionResolveStrategy.MatchingBrowser) ? driverConfig.GetMatchingBrowserVersion() : version; var url = UrlHelper.BuildUrl(architecture.Equals(Architecture.X32) ? driverConfig.GetUrl32() : driverConfig.GetUrl64(), version); var binaryPath = FileHelper.GetBinDestination(driverConfig.GetName(), version, architecture, driverConfig.GetBinaryName()); if (!File.Exists(binaryPath) || !Environment.GetEnvironmentVariable("PATH").Contains(binaryPath)) { lock (WebDriverDownloadingLock) { new DriverManager().SetUpDriver(url, binaryPath, driverConfig.GetBinaryName()); } } }