public static IWebDriver GetLocalWebDriver(BrowserTypes browser, bool headless = false) { if (headless && !(browser == BrowserTypes.Chrome || browser == BrowserTypes.Firefox)) { throw new ArgumentException($"Headless mode is not currently supported for {browser}."); } switch (browser) { case BrowserTypes.Firefox: return(GetLocalWebDriver <FirefoxDriver, FirefoxOptions>(StaticDriverOptionsFactory.GetFirefoxOptions(headless))); case BrowserTypes.Chrome: return(GetLocalWebDriver <ChromeDriver, ChromeOptions>(StaticDriverOptionsFactory.GetChromeOptions(headless))); case BrowserTypes.InternetExplorer: return(GetLocalWebDriver <InternetExplorerDriver, InternetExplorerOptions>(StaticDriverOptionsFactory.GetInternetExplorerOptions())); case BrowserTypes.Edge: return(GetLocalWebDriver <EdgeDriver, EdgeOptions>(StaticDriverOptionsFactory.GetEdgeOptions())); case BrowserTypes.Safari: return(GetLocalWebDriver <SafariDriver, SafariOptions>(StaticDriverOptionsFactory.GetSafariOptions())); default: throw new PlatformNotSupportedException($"{browser} is not currently supported."); } }
public void Uhd4KBrowserIsOfRequestedSize() { Driver = StaticWebDriverFactory.GetLocalWebDriver(StaticDriverOptionsFactory.GetFirefoxOptions(true), WindowSize.UHD4K); Size size = Driver.Manage().Window.Size; size.ShouldSatisfyAllConditions ( () => size.Height.ShouldBe(2160), () => size.Width.ShouldBe(3840) ); }
public static IWebDriver GetRemoteWebDriver(BrowserTypes browser, Uri gridUrl, PlatformType platformType = PlatformType.Any) { switch (browser) { case BrowserTypes.Firefox: return(GetRemoteWebDriver(StaticDriverOptionsFactory.GetFirefoxOptions(platformType), gridUrl)); case BrowserTypes.Chrome: return(GetRemoteWebDriver(StaticDriverOptionsFactory.GetChromeOptions(platformType), gridUrl)); case BrowserTypes.InternetExplorer: return(GetRemoteWebDriver(StaticDriverOptionsFactory.GetInternetExplorerOptions(platformType), gridUrl)); case BrowserTypes.Edge: return(GetRemoteWebDriver(StaticDriverOptionsFactory.GetEdgeOptions(platformType), gridUrl)); case BrowserTypes.Safari: return(GetRemoteWebDriver(StaticDriverOptionsFactory.GetSafariOptions(platformType), gridUrl)); default: throw new PlatformNotSupportedException($"{browser} is not currently supported."); } }
//public static IWebDriver GetLocalWebDriver(ChromeOptions options, WindowSize windowSize = WindowSize.HD) //{ // IWebDriver driver = new ChromeDriver(DriverPath, options); // return SetWindowSize(driver, windowSize); //} public static IWebDriver GetLocalWebDriver(FirefoxOptions options, WindowSize windowSize = WindowSize.HD) { //IWebDriver driver = new FirefoxDriver(DriverPath, options); //return SetWindowSize(driver, windowSize); return(GetLocalWebDriver <FirefoxDriver, FirefoxOptions>(StaticDriverOptionsFactory.GetFirefoxOptions(false))); }
public void HdBrowserIsOfRequestedSize() { //Driver = StaticWebDriverFactory.GetLocalWebDriver(StaticDriverOptionsFactory.GetFirefoxOptions(true), WindowSize.HD); Driver = StaticWebDriverFactory.GetLocalWebDriver <FirefoxDriver, FirefoxOptions>(StaticDriverOptionsFactory.GetFirefoxOptions(true)); Size size = Driver.Manage().Window.Size; size.ShouldSatisfyAllConditions ( () => size.Width.ShouldBe(1366), () => size.Height.ShouldBe(768) ); }