public static Browser GetBrowser() { IBrowserConfiguration config = (BrowserConfigurationSection)ConfigurationManager.GetSection("browserConfigurationGroup/browserConfiguration"); var factory = GetFactory(config.BrowserType); return(factory.Build(config)); }
public BrowserContext(IBrowserConfiguration browserConfiguration) { if (browserConfiguration == null) throw new ArgumentNullException("browserConfiguration"); this.browserConfiguration = browserConfiguration; }
public BrowserManager(IBrowserConfiguration configuration, IProcessProxy processProxy) { this.browserConfiguration = configuration; this.processProxy = processProxy; this.DetectDefaultBrowserDefinition(); }
public DownloadHelper([NotNull] IBrowserConfiguration browserConfiguration, [NotNull] string fileName, TimeSpan maxDownloadTimeSpan) { ArgumentUtility.CheckNotNull("browserConfiguration", browserConfiguration); ArgumentUtility.CheckNotNullOrEmpty("fileName", fileName); _browserConfiguration = browserConfiguration; _fileName = fileName; _fullFilePath = Path.Combine(GetDownloadsDirectory(), _fileName); _maxDownloadTimeSpan = maxDownloadTimeSpan; }
public override Browser Build(IBrowserConfiguration configuration) { IWebDriver driver = new ChromeDriver(); if (configuration.Resolution.Width != null || configuration.Resolution.Height != null) { int width = Convert.ToInt32(configuration.Resolution.Width); int height = Convert.ToInt32(configuration.Resolution.Height); driver.Manage().Window.Size = new Size(width, height); } return(new ChromeBrowser(driver)); }
public WebTestHelper( [NotNull] IBrowserConfiguration browserConfiguration, [NotNull] ICoypuConfiguration coypuConfiguration, [NotNull] IWebTestConfiguration webTestConfiguration) { ArgumentUtility.CheckNotNull("browserConfiguration", browserConfiguration); ArgumentUtility.CheckNotNull("coypuConfiguration", coypuConfiguration); ArgumentUtility.CheckNotNull("webTestConfiguration", webTestConfiguration); _browserConfiguration = browserConfiguration; _coypuConfiguration = coypuConfiguration; _webTestConfiguration = webTestConfiguration; }
/// <summary> /// Creates a Coypu <see cref="BrowserSession"/> using the configuration given by <paramref name="browserConfiguration"/>. /// </summary> /// <param name="browserConfiguration">The browser configuration to use.</param> /// /// <param name="coypuConfiguration">The Coypu configuration to use.</param> /// <returns>A new Coypu <see cref="BrowserSession"/>.</returns> public static BrowserSession CreateBrowser( [NotNull] IBrowserConfiguration browserConfiguration, [NotNull] ICoypuConfiguration coypuConfiguration) { ArgumentUtility.CheckNotNull("browserConfiguration", browserConfiguration); ArgumentUtility.CheckNotNull("coypuConfiguration", coypuConfiguration); var sessionConfiguration = new SessionConfiguration { Browser = browserConfiguration.Browser, RetryInterval = coypuConfiguration.RetryInterval, Timeout = coypuConfiguration.SearchTimeout, ConsiderInvisibleElements = WebTestingConstants.ShouldConsiderInvisibleElements, Match = WebTestingConstants.DefaultMatchStrategy, TextPrecision = WebTestingConstants.DefaultTextPrecision }; if (sessionConfiguration.Browser == Browser.Chrome) { // Todo RM-6337: Switch back to always using the default Chrome driver as soon as the ActaNova language problem has been solved. if (ConfigurationManager.AppSettings["CustomChromeUserDataDir"] != null) { sessionConfiguration.Driver = typeof(CustomChromeDriver); return(new BrowserSession(sessionConfiguration, new CustomChromeDriver())); } sessionConfiguration.Driver = typeof(SeleniumWebDriver); return(new BrowserSession(sessionConfiguration)); } if (sessionConfiguration.Browser == Browser.InternetExplorer) { sessionConfiguration.Driver = typeof(CustomInternetExplorerDriver); return(new BrowserSession(sessionConfiguration, new CustomInternetExplorerDriver())); } throw new NotSupportedException(string.Format("Only browsers '{0}' and '{1}' are supported.", Browser.Chrome, Browser.InternetExplorer)); }
public abstract Browser Build(IBrowserConfiguration configuration);