/// <summary> /// Creates the web driver. /// </summary> /// <param name="seleniumDriver">The selenium driver.</param> /// <param name="browserFactoryConfiguration">The browser factory configuration.</param> /// <returns>The created web driver.</returns> /// <exception cref="System.InvalidOperationException">Thrown if the browser is not supported.</exception> internal IWebDriver CreateWebDriver(ISeleniumDriver seleniumDriver, BrowserFactoryConfiguration browserFactoryConfiguration) { IWebDriver driver = seleniumDriver.Create(browserFactoryConfiguration); // Set Driver Settings var managementSettings = driver.Manage(); // Set timeouts var applicationConfiguration = SettingHelper.GetConfigurationSection().Application; var timeouts = managementSettings.Timeouts(); timeouts.ImplicitWait = browserFactoryConfiguration.ElementLocateTimeout; timeouts.PageLoad = browserFactoryConfiguration.PageLoadTimeout; ActionBase.DefaultTimeout = browserFactoryConfiguration.ElementLocateTimeout; WaitForPageAction.DefaultTimeout = browserFactoryConfiguration.PageLoadTimeout; ActionBase.RetryValidationUntilTimeout = applicationConfiguration.RetryValidationUntilTimeout; if (seleniumDriver.MaximizeWindow) { // Maximize window managementSettings.Window.Maximize(); } return(driver); }
/// <summary> /// Creates the browser. /// </summary> /// <param name="browserType">Type of the browser.</param> /// <param name="browserFactoryConfiguration">The browser factory configuration.</param> /// <param name="logger">The logger.</param> /// <returns>A browser object.</returns> /// <exception cref="System.InvalidOperationException">Thrown if the browser type is not supported.</exception> protected override IBrowser CreateBrowser(BrowserType browserType, BrowserFactoryConfigurationElement browserFactoryConfiguration, ILogger logger) { this.SeleniumDriver = this.GetSeleniumDriver(browserType, browserFactoryConfiguration); var launchAction = new Func <IWebDriver>(() => this.CreateWebDriver(this.SeleniumDriver, browserFactoryConfiguration)); var browser = new Lazy <IWebDriver>(launchAction, LazyThreadSafetyMode.None); return(new SeleniumBrowser(browser, logger)); }
/// <summary> /// Gets the selenium driver. /// </summary> /// <param name="browserType">Type of the browser.</param> /// <param name="browserFactoryConfiguration">The browser factory configuration.</param> /// <returns>The selenium driver.</returns> internal ISeleniumDriver GetSeleniumDriver(BrowserType browserType, BrowserFactoryConfigurationElement browserFactoryConfiguration) { if (this.SeleniumDriver != null) { return(this.SeleniumDriver); } switch (browserType) { case BrowserType.IE: this.SeleniumDriver = new SeleniumInternetExplorerDriver(browserFactoryConfiguration); break; case BrowserType.FireFox: this.SeleniumDriver = new SeleniumFirefoxDriver(browserFactoryConfiguration); break; case BrowserType.Chrome: this.SeleniumDriver = new SeleniumChromeDriver(browserFactoryConfiguration); break; case BrowserType.ChromeHeadless: this.SeleniumDriver = new SeleniumChromeDriver(browserFactoryConfiguration); break; case BrowserType.PhantomJS: this.SeleniumDriver = new SeleniumPhantomJSDriver(browserFactoryConfiguration); break; case BrowserType.Safari: this.SeleniumDriver = new SeleniumSafariDriver(browserFactoryConfiguration); break; case BrowserType.Opera: this.SeleniumDriver = new SeleniumOperaDriver(browserFactoryConfiguration); break; case BrowserType.Edge: this.SeleniumDriver = new SeleniumEdgeDriver(browserFactoryConfiguration); break; default: throw new InvalidOperationException( $"Browser type '{browserType}' is not supported in Selenium local mode. Did you mean to configure a remote driver?"); } return(this.SeleniumDriver); }
public LogintoWebsiteSteps(ISeleniumDriver seleniumdriver) { this.seleniumdriver = seleniumdriver; this.driver = seleniumdriver.WebDriver; }
public RemeberMeAndCancelSteps(ISeleniumDriver seleniumdriver) { this.seleniumdriver = seleniumdriver; this.driver = seleniumdriver.WebDriver; }
public PageActions(ISeleniumDriver webDriver, IWebPage webPage) { _webDriver = webDriver; _webPage = webPage; }
/// <summary> /// Validates the driver setup. /// </summary> /// <param name="logger">The logger.</param> protected override void ValidateDriverSetup(ILogger logger) { ISeleniumDriver seleniumDriver = this.CreateSeleniumDriver(); seleniumDriver.Validate(this.Configuration, SeleniumDriverPath); }
public HtmlAgilityPackService(ISeleniumDriver driver) { this.driver = driver; }
/// <summary> /// Validates the driver setup. /// </summary> /// <param name="browserType">Type of the browser.</param> /// <param name="browserFactoryConfiguration">The browser factory configuration.</param> protected override void ValidateDriverSetup(BrowserType browserType, BrowserFactoryConfigurationElement browserFactoryConfiguration) { ISeleniumDriver seleniumDriver = this.GetSeleniumDriver(browserType, browserFactoryConfiguration); seleniumDriver.Validate(SeleniumDriverPath); }
public ForgotUsernameSteps(ISeleniumDriver seleniumdriver) { this.seleniumdriver = seleniumdriver; this.driver = seleniumdriver.WebDriver; }
public LoginFailureScenarioSteps(ISeleniumDriver seleniumdriver) { this.seleniumdriver = seleniumdriver; this.driver = seleniumdriver.WebDriver; }
public void BeforeScenario() { _seleniumDriver = IOC.Resolve <ISeleniumDriver>(FeatureContext.FeatureContainer); _testData = IOC.Resolve <ITestData>(FeatureContext.FeatureContainer); _parsonDetails = IOC.Resolve <IPerson>(FeatureContext.FeatureContainer); }
public ForgotPassSteps(ISeleniumDriver seleniumdriver) { this.seleniumdriver = seleniumdriver; this.driver = seleniumdriver.WebDriver; }
public WebDriverHook(ISeleniumDriver seleniumdriver) { this.seleniumdriver = seleniumdriver; this.driver = seleniumdriver.WebDriver; }