/// <summary> /// Create BrowserAdapter based on configuration /// </summary> /// <param name="config">BrowserAdapter configuration</param> /// <param name="driver">Existing driver, if null the driver will be created using provided configuration</param> public static BrowserAdapter Create(BrowserAdapterConfig config, RemoteWebDriver driver = null) { var browserAdapter = new BrowserAdapter(); browserAdapter.Driver = driver ?? SeleniumDriverFactory.CreateDriver(config); var browserCameraConfig = config.BrowserCameraConfig ?? BrowserCameraConfig.CreateDefault(); browserAdapter.browserCamera = BrowserCameraFactory.CreateNew(browserAdapter.Driver, browserCameraConfig); browserAdapter.errorBrowserCamera = BrowserCameraFactory.CreateErrorBrowserCamera(browserAdapter.Driver); var navigator = new Navigator(browserAdapter.Driver, config.PageUrl, config.MeasureEndpointCoverage); browserAdapter.navigator = navigator; browserAdapter.supportedInputsAdapters = config.InputAdapters.ToList(); browserAdapter.SetupBrowserDimensions(config.BrowserDimensions); browserAdapter.BrowserName = config.BrowserType.ToString(); browserAdapter.NumberOfInputSetRetries = config.NumberOfInputSetRetries; browserAdapter.AfterFieldValueSetAction = config.AfterFieldValueSetAction; browserAdapter.errorReportBuilder = TelluriumErrorReportBuilderFactory.Create(config); browserAdapter.endpointCoverageReportBuilder = EndpointCoverageReportBuilderFactory.Create(config, navigator); browserAdapter.errorScreenshotStorage = ScreenshotStorageFactory.CreateForErrorScreenshot(config); if (config.AnimationsDisabled) { browserAdapter.navigator.PageReload += (sender, args) => browserAdapter.Driver.DisableAnimations(); } return(browserAdapter); }
/// <summary> /// Creates a set of browers based on the input types /// for use with a test case. /// </summary> /// <param name="browserTypes"></param> /// <returns></returns> public static IEnumerable <object[]> BuildDrivers(params BrowserType[] browserTypes) { SeleniumDriverFactory driverFactory = new SeleniumDriverFactory(); if (ConfigurationManager.Current == null) { ConfigurationManager.InitializeConfiguration(TestContext.CurrentContext.WorkDirectory); } foreach (var browserType in browserTypes) { yield return(new object[] { driverFactory.Build(browserType, ConfigurationManager.Current) }); } }
private static RemoteWebDriver DriverFactory(DriverTypes driverType, string driverPath) => SeleniumDriverFactory.Factory( Type.GetType(driverType.ToString()), driverPath);
private static IAutomationBrowser GetSeleniumBrowser(ISweetPotatoSettings sweetPotatoSettings) { var seleniumDriverFactory = new SeleniumDriverFactory(); return(new SeleniumBrowser(seleniumDriverFactory, sweetPotatoSettings, new SeleniumElementFactory())); }
public void OneTimeSetUp() { _factory = new SeleniumDriverFactory(new SupportedDrivers()); }