Exemple #1
0
        /// <summary>
        /// Return a configured RemoteWebDriver of the given browser type with default settings.
        /// </summary>
        /// <param name="browser"></param>
        /// <param name="gridUrl"></param>
        /// <param name="platformType"></param>
        /// <returns></returns>
        public static IWebDriver GetRemoteWebDriver(
            Browser browser,
            Uri gridUrl,
            PlatformType platformType = PlatformType.Any)
        {
            switch (browser)
            {
            case Browser.Firefox:
                return(GetRemoteWebDriver(StaticDriverOptionsFactory.GetFirefoxOptions(platformType), gridUrl));

            case Browser.Chrome:
                return(GetRemoteWebDriver(StaticDriverOptionsFactory.GetChromeOptions(platformType), gridUrl));

            case Browser.InternetExplorer:
                return(GetRemoteWebDriver(StaticDriverOptionsFactory.GetInternetExplorerOptions(platformType), gridUrl));

            case Browser.Edge:
                return(GetRemoteWebDriver(StaticDriverOptionsFactory.GetEdgeOptions(platformType), gridUrl));

            case Browser.Safari:
                return(GetRemoteWebDriver(StaticDriverOptionsFactory.GetSafariOptions(platformType), gridUrl));

            default:
                throw new PlatformNotSupportedException($"{browser} is not currently supported.");
            }
        }
Exemple #2
0
        public virtual IWebDriver GetLocalWebDriver(Browser browser, bool headless = false)
        {
            if (headless && !(browser == Browser.Chrome || browser == Browser.Firefox))
            {
                throw new ArgumentException($"Headless mode is not currently supported for {browser}.");
            }
            switch (browser)
            {
            case Browser.Firefox:
                return(GetLocalWebDriver(StaticDriverOptionsFactory.GetFirefoxOptions(headless)));

            case Browser.Chrome:
                return(GetLocalWebDriver(StaticDriverOptionsFactory.GetChromeOptions(headless)));

            case Browser.InternetExplorer:
                return(GetLocalWebDriver(StaticDriverOptionsFactory.GetInternetExplorerOptions()));

            case Browser.Edge:
                return(GetLocalWebDriver(StaticDriverOptionsFactory.GetEdgeOptions()));

            case Browser.Safari:
                return(GetLocalWebDriver(StaticDriverOptionsFactory.GetSafariOptions()));

            default:
                throw new PlatformNotSupportedException($"{browser} is not currently supported.");
            }
        }
 public virtual T SetPlatform <T>(T options, PlatformType platformType) where T : DriverOptions
 {
     return(StaticDriverOptionsFactory.SetPlatform(options, platformType));
 }
 public virtual SafariOptions GetSafariOptions(PlatformType platformType = PlatformType.Any)
 {
     return(StaticDriverOptionsFactory.GetSafariOptions(platformType));
 }
 public virtual InternetExplorerOptions GetInternetExplorerOptions(PlatformType platformType = PlatformType.Any)
 {
     return(StaticDriverOptionsFactory.GetInternetExplorerOptions(platformType));
 }
 public virtual FirefoxOptions GetFirefoxOptions(bool headless = false, PlatformType platformType = PlatformType.Any)
 {
     return(StaticDriverOptionsFactory.GetFirefoxOptions(headless, platformType));
 }
 public virtual FirefoxOptions GetFirefoxOptions(PlatformType platformType = PlatformType.Any)
 {
     return(StaticDriverOptionsFactory.GetFirefoxOptions(platformType));
 }