示例#1
0
        public void SetUpDriver(IDriverConfig config, string version = "Latest",
                                Architecture architecture            = Architecture.Auto)
        {
            architecture = architecture.Equals(Architecture.Auto) ? ArchitectureHelper.GetArchitecture() : architecture;
            version      = version.Equals("Latest") ? config.GetLatestVersion() : version;
            var url = architecture.Equals(Architecture.X32) ? config.GetUrl32() : config.GetUrl64();

            url = UrlHelper.BuildUrl(url, version);
            var binaryPath = FileHelper.GetBinDestination(config.GetName(), version, architecture,
                                                          config.GetBinaryName());

            SetUpDriver(url, binaryPath, config.GetBinaryName());
        }
 public void SetUpDriver(IDriverConfig config, string version = VersionResolveStrategy.Latest,
                         Architecture architecture            = Architecture.Auto)
 {
     lock (Object)
     {
         architecture = architecture.Equals(Architecture.Auto)
             ? ArchitectureHelper.GetArchitecture()
             : architecture;
         version = GetVersionToDownload(config, version);
         var url = architecture.Equals(Architecture.X32) ? config.GetUrl32() : config.GetUrl64();
         url = UrlHelper.BuildUrl(url, version);
         var binaryPath = FileHelper.GetBinDestination(config.GetName(), version, architecture,
                                                       config.GetBinaryName());
         SetUpDriver(url, binaryPath, config.GetBinaryName());
     }
 }
示例#3
0
        public List <Tuple <string, string> > GetDriverInfo(IDriverConfig browserConfig, Architecture architecture, string browserVersion)
        {
            var baseUrlForSelectedArchitecture = architecture.Equals(Architecture.X32) ? browserConfig.GetUrl32() : browserConfig.GetUrl64();

            browserVersion = browserVersion.Equals("Latest", StringComparison.InvariantCultureIgnoreCase) ? browserVersion : CompatibilityHelper.GetMajorVersion(browserVersion);

            var driverVersion = browserConfig.GetDriverVersion(browserVersion);

            var url = UrlHelper.BuildUrl(baseUrlForSelectedArchitecture, driverVersion);

            var fileAndFolderPath = FileHelper.GetDriverDestination(browserConfig.GetName(), driverVersion, architecture, browserConfig.GetBinaryName());

            List <Tuple <string, string> > driverInfo = new List <Tuple <string, string> >();

            driverInfo.Add(new Tuple <string, string>(url, fileAndFolderPath));

            return(driverInfo);
        }
        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());
                }
            }
        }