/// <summary>
        /// Base constructor for RatDriver
        /// </summary>
        /// <param name="driverSettings">Settings file for the Driver being instantiated.</param>
        /// <param name="performanceTimings">Whether to obtain performance timings for the browser.</param>
        public RatDriver([Optional, DefaultParameterValue(null)] IDriverSettings driverSettings,
                         [Optional, DefaultParameterValue(false)] bool performanceTimings)
        {
            try
            {
                RecordPerformance = performanceTimings;
                if (performanceTimings)
                {
                    InitialiseRatWatch(performanceTimings);
                }


                string driverType = typeof(TWebDriver).Name;
                EstablishDriverSettings(driverType);

                if (!_runTests)
                {
                    throw new LiberatorOSException(_browserError);
                }

                if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ||
                    RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
                {
                    GetProcesses(driverType, ProcessCollectionTime.InitialisationStart);
                }


                string          type       = "Liberator.Driver.BrowserControl." + driverType + "Control";
                IBrowserControl controller = (IBrowserControl)Activator.CreateInstance(Type.GetType(type), driverSettings);
                Driver = (TWebDriver)controller.StartDriver();

                if (performanceTimings)
                {
                    RatTimerCollection.StopTimer(EnumTiming.Instantiation);
                }

                WaitForPageToLoad(null);
                WindowHandles.Add(Driver.CurrentWindowHandle, Driver.Title);


                if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ||
                    RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
                {
                    GetProcesses(driverType, ProcessCollectionTime.InitialisationEnd);
                }
            }
            catch (Exception ex)
            {
                if (ex.GetType() != typeof(LiberatorOSException))
                {
                    Console.Out.WriteLine("An unexpected error has been detected.");
                }
                HandleErrors(ex);
            }
        }
Exemple #2
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());
                }
            }
        }
 protected ApplicationFactory()
 {
     LocalizedLogger      = AqualityServices.LocalizedLogger;
     DriverSettings       = AqualityServices.Get <IDriverSettings>();
     timeoutConfiguration = AqualityServices.Get <ITimeoutConfiguration>();
 }
Exemple #4
0
 /// <summary>
 /// Instantiates class using JSON file with general settings.
 /// </summary>
 /// <param name="settingsFile">JSON settings file.</param>
 /// <param name="driverSettings">Instance of <see cref="IDriverSettings"/></param>
 public ApplicationProfile(ISettingsFile settingsFile, IDriverSettings driverSettings)
 {
     SettingsFile   = settingsFile;
     DriverSettings = driverSettings;
 }
Exemple #5
0
 protected WebTest(IDriverSettings driverSettings)
 {
     _driverSettings = driverSettings;
 }
Exemple #6
0
 public Driver(IDriverSettings driverSettings, IComponentCreator componentCreator)
 {
     _driverSettings  = driverSettings;
     ComponentCreator = componentCreator;
 }
Exemple #7
0
 public Test(IDriverSettings driverSettings) : base(driverSettings)
 {
 }