/// <summary> /// Initialize a new Firefox driver /// </summary> /// <param name="commandTimeout">Browser command timeout</param> /// <param name="firefoxOptions">Browser options</param> /// <param name="size">Browser size in the following format: MAXIMIZE, DEFAULT, or #x# (such as 1920x1080)</param> /// <returns>A new Firefox driver</returns> public static IWebDriver GetFirefoxDriver(TimeSpan commandTimeout, FirefoxOptions firefoxOptions, string size = "MAXIMIZE") { return(CreateDriver(() => { LazyInitializer.EnsureInitialized(ref FirefoxDriverPath, () => new DriverManager().SetUpDriver(new FirefoxConfig(), SeleniumConfig.GetFirefoxVersion())); // Add support for encoding 437 that was removed in .net core Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); var driver = new FirefoxDriver(Path.GetDirectoryName(FirefoxDriverPath), firefoxOptions, commandTimeout); SetBrowserSize(driver, size); return driver; }, SeleniumConfig.GetRetryRefused())); }