Exemplo n.º 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));
                }
            }
        }
Exemplo n.º 2
0
        public DriverOptions CreateOptions(DriverOptionsJsonSection section)
        {
            TOptions options = new TOptions();

            MapOptions(section, options);

            return(options);
        }
Exemplo n.º 3
0
        protected override void MapOptions(DriverOptionsJsonSection section, EdgeOptions options)
        {
            base.MapOptions(section, options);

            if (section.Extensions?.Any() ?? false)
            {
                options.AddExtensionPaths(section.Extensions);
            }
        }
Exemplo n.º 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));
                }
            }
        }
Exemplo n.º 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();
            }
        }
Exemplo n.º 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);
                }
            }
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 8
0
        public DriverOptions CreateOptions(DriverOptionsJsonSection section)
        {
            IDriverJsonMapper mapper = GetOptionsMapper(section.Type);

            return(mapper.CreateOptions(section));
        }