Ejemplo n.º 1
0
        public static 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.");
            }
        }
Ejemplo n.º 2
0
        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.");
            }
        }