OpenQA.Selenium.IE.InternetExplorerOptions.ToCapabilities C# (CSharp) Метод

ToCapabilities() публичный Метод

Returns DesiredCapabilities for IE with these options included as capabilities. This copies the options. Further changes will not be reflected in the returned capabilities.
public ToCapabilities ( ) : ICapabilities
Результат ICapabilities
        public ICapabilities ToCapabilities()
        {
            DesiredCapabilities capabilities = DesiredCapabilities.InternetExplorer();
            capabilities.SetCapability(EnableNativeEventsCapability, this.enableNativeEvents);
            capabilities.SetCapability(EnablePersistentHoverCapability, this.enablePersistentHover);
            if (this.ignoreProtectedModeSettings)
            {
                capabilities.SetCapability(IgnoreProtectedModeSettingsCapability, true);
            }

            if (this.ignoreZoomLevel)
            {
                capabilities.SetCapability(IgnoreZoomSettingCapability, true);
            }

            if (!string.IsNullOrEmpty(this.initialBrowserUrl))
            {
                capabilities.SetCapability(InitialBrowserUrlCapability, this.initialBrowserUrl);
            }

            if (this.elementScrollBehavior == InternetExplorerElementScrollBehavior.Bottom)
            {
                capabilities.SetCapability(ElementScrollBehaviorCapability, 1);
            }

            if (this.unexpectedAlertBehavior != InternetExplorerUnexpectedAlertBehavior.Default)
            {
                string unexpectedAlertBehaviorSetting = "dismiss";
                switch (this.unexpectedAlertBehavior)
                {
                    case InternetExplorerUnexpectedAlertBehavior.Ignore:
                        unexpectedAlertBehaviorSetting = "ignore";
                        break;

                    case InternetExplorerUnexpectedAlertBehavior.Accept:
                        unexpectedAlertBehaviorSetting = "accept";
                        break;
                }

                capabilities.SetCapability(UnexpectedAlertBehaviorCapability, unexpectedAlertBehaviorSetting);
            }

            foreach (KeyValuePair<string, object> pair in this.additionalCapabilities)
            {
                capabilities.SetCapability(pair.Key, pair.Value);
            }

            return capabilities;
        }

Usage Example

Пример #1
0
        private static ICapabilities ConvertOptionsToCapabilities(InternetExplorerOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options", "options must not be null");
            }

            return(options.ToCapabilities());
        }
All Usage Examples Of OpenQA.Selenium.IE.InternetExplorerOptions::ToCapabilities