Example #1
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.");
            }
        }
Example #2
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.");
            }
        }
 public virtual ChromeOptions GetChromeOptions(bool headless = false, PlatformType platformType = PlatformType.Any)
 {
     return(StaticDriverOptionsFactory.GetChromeOptions(headless, platformType));
 }
 public virtual ChromeOptions GetChromeOptions(PlatformType platformType = PlatformType.Any)
 {
     return(StaticDriverOptionsFactory.GetChromeOptions(platformType));
 }