Пример #1
0
 private bool CanAutoResolveVersion()
 {
     // We provide autoresolve version for Chrome only.
     return(StringComparer.OrdinalIgnoreCase.Equals(
                _driverConfig.GetName(),
                new ChromeConfig().GetName()
                ));
 }
        protected void DriverDownloadTest(IDriverConfig driverConfig)
        {
            new DriverManager().SetupLatestDriver(Directory.GetCurrentDirectory(), driverConfig);
            var pathVariable = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Process);

            Assert.NotNull(pathVariable);
            Assert.Contains(driverConfig.GetName(), pathVariable);
        }
 public static string DriverDirectoryFullPath(this IDriverConfig driverConfig)
 {
     if (driverConfig == null)
     {
         throw new ArgumentNullException(nameof(driverConfig));
     }
     return(Path.Combine(Environment.CurrentDirectory,
                         driverConfig.GetName(), driverConfig.GetLatestVersion(),
                         $"{ArchitectureHelper.GetArchitecture():F}"));
 }
Пример #4
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());
        }
Пример #5
0
        private static void SetUpDriver(IDriverConfig driverConfig, IDriverSettings driverSettings)
        {
            var architecture = driverSettings.SystemArchitecture.Equals(Architecture.Auto) ? ArchitectureHelper.GetArchitecture() : driverSettings.SystemArchitecture;
            var version      = driverSettings.WebDriverVersion.Equals("Latest") ? driverConfig.GetLatestVersion() : driverSettings.WebDriverVersion;
            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());
                }
            }
        }
 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());
     }
 }
Пример #7
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);
        }