예제 #1
0
        protected virtual void MapOptions(DriverOptionsJsonSection section, TOptions options)
        {
            var properties = section.ExtraPropertiesMap;

            if (properties?.Any() ?? false)
            {
                ObjectMapper.Map(properties, options);
            }

            if (section.LoggingPreferences?.Any() ?? false)
            {
                foreach (var item in section.LoggingPreferences)
                {
                    options.SetLoggingPreference(item.Key, item.Value);
                }
            }

            if (section.AdditionalCapabilities != null)
            {
                foreach (var item in section.AdditionalCapabilities.ExtraPropertiesMap)
                {
                    options.AddAdditionalCapability(item.Key, FillTemplateVariables(item.Value));
                }
            }
        }
예제 #2
0
        public DriverOptions CreateOptions(DriverOptionsJsonSection section)
        {
            TOptions options = new TOptions();

            MapOptions(section, options);

            return(options);
        }
예제 #3
0
        protected override void MapOptions(DriverOptionsJsonSection section, EdgeOptions options)
        {
            base.MapOptions(section, options);

            if (section.Extensions?.Any() ?? false)
            {
                options.AddExtensionPaths(section.Extensions);
            }
        }
예제 #4
0
        protected override void MapOptions(DriverOptionsJsonSection section, OperaOptions options)
        {
            base.MapOptions(section, options);

            if (section.GlobalAdditionalCapabilities != null)
            {
                foreach (var item in section.GlobalAdditionalCapabilities.ExtraPropertiesMap)
                {
                    options.AddAdditionalCapability(item.Key, FillTemplateVariables(item.Value), true);
                }
            }

            if (section.Proxy != null)
            {
                options.Proxy = section.Proxy.ToProxy();
            }

            if (section.Arguments?.Any() ?? false)
            {
                options.AddArguments(section.Arguments);
            }

            if (section.ExcludedArguments?.Any() ?? false)
            {
                options.AddExcludedArguments(section.ExcludedArguments);
            }

            if (section.Extensions?.Any() ?? false)
            {
                options.AddExtensions(section.Extensions);
            }

            if (section.EncodedExtensions?.Any() ?? false)
            {
                options.AddEncodedExtensions(section.EncodedExtensions);
            }

            if (section.UserProfilePreferences != null)
            {
                foreach (var item in section.UserProfilePreferences.ExtraPropertiesMap)
                {
                    options.AddUserProfilePreference(item.Key, FillTemplateVariables(item.Value));
                }
            }

            if (section.LocalStatePreferences != null)
            {
                foreach (var item in section.LocalStatePreferences.ExtraPropertiesMap)
                {
                    options.AddLocalStatePreference(item.Key, FillTemplateVariables(item.Value));
                }
            }
        }
예제 #5
0
        protected override void MapOptions(DriverOptionsJsonSection section, InternetExplorerOptions options)
        {
            base.MapOptions(section, options);

            if (section.GlobalAdditionalCapabilities != null)
            {
                foreach (var item in section.GlobalAdditionalCapabilities.ExtraPropertiesMap)
                {
                    options.AddAdditionalCapability(item.Key, FillTemplateVariables(item.Value), true);
                }
            }

            if (section.Proxy != null)
            {
                options.Proxy = section.Proxy.ToProxy();
            }
        }
예제 #6
0
        protected override void MapOptions(DriverOptionsJsonSection section, FirefoxOptions options)
        {
            base.MapOptions(section, options);

            if (section.GlobalAdditionalCapabilities != null)
            {
                foreach (var item in section.GlobalAdditionalCapabilities.ExtraPropertiesMap)
                {
                    options.AddAdditionalCapability(item.Key, FillTemplateVariables(item.Value), true);
                }
            }

            if (section.Proxy != null)
            {
                options.Proxy = section.Proxy.ToProxy();
            }

            if (section.Arguments?.Any() ?? false)
            {
                options.AddArguments(section.Arguments);
            }

            if (section.Profile != null)
            {
                if (options.Profile == null || !string.IsNullOrWhiteSpace(section.Profile.ProfileDirectory) || section.Profile.DeleteSourceOnClean != null)
                {
                    options.Profile = CreateProfile(section.Profile);
                }

                MapProfile(section.Profile, options.Profile);
            }

            if (section.Preferences != null)
            {
                foreach (var item in section.Preferences.ExtraPropertiesMap)
                {
                    SetOptionsPreference(item.Key, item.Value, options);
                }
            }
        }
예제 #7
0
        protected override void MapOptions(DriverOptionsJsonSection section, ChromeOptions options)
        {
            base.MapOptions(section, options);

            if (section.GlobalAdditionalCapabilities != null)
            {
                foreach (var item in section.GlobalAdditionalCapabilities.ExtraPropertiesMap)
                {
                    options.AddAdditionalCapability(item.Key, FillTemplateVariables(item.Value), true);
                }
            }

            if (section.Proxy != null)
            {
                options.Proxy = section.Proxy.ToProxy();
            }

            if (section.Arguments?.Any() ?? false)
            {
                options.AddArguments(section.Arguments);
            }

            if (section.ExcludedArguments?.Any() ?? false)
            {
                options.AddExcludedArguments(section.ExcludedArguments);
            }

            if (section.Extensions?.Any() ?? false)
            {
                options.AddExtensions(section.Extensions);
            }

            if (section.EncodedExtensions?.Any() ?? false)
            {
                options.AddEncodedExtensions(section.EncodedExtensions);
            }

            if (section.WindowTypes?.Any() ?? false)
            {
                options.AddWindowTypes(section.WindowTypes);
            }

            if (section.PerformanceLoggingPreferences != null)
            {
                options.PerformanceLoggingPreferences = new ChromePerformanceLoggingPreferences();
                MapPerformanceLoggingPreferences(section.PerformanceLoggingPreferences, options.PerformanceLoggingPreferences);
            }

            if (section.UserProfilePreferences != null)
            {
                foreach (var item in section.UserProfilePreferences.ExtraPropertiesMap)
                {
                    options.AddUserProfilePreference(item.Key, FillTemplateVariables(item.Value));
                }
            }

            if (section.LocalStatePreferences != null)
            {
                foreach (var item in section.LocalStatePreferences.ExtraPropertiesMap)
                {
                    options.AddLocalStatePreference(item.Key, FillTemplateVariables(item.Value));
                }
            }

            if (!string.IsNullOrWhiteSpace(section.MobileEmulationDeviceName))
            {
                options.EnableMobileEmulation(section.MobileEmulationDeviceName);
            }

            if (section.MobileEmulationDeviceSettings != null)
            {
                options.EnableMobileEmulation(section.MobileEmulationDeviceSettings);
            }
        }
예제 #8
0
        public DriverOptions CreateOptions(DriverOptionsJsonSection section)
        {
            IDriverJsonMapper mapper = GetOptionsMapper(section.Type);

            return(mapper.CreateOptions(section));
        }