public void SetTimeoutsGetWaitDriver() { IWebDriver driver = null; IWebDriver newDriver = null; try { driver = WebDriverFactory.GetDefaultBrowser(); newDriver = WebDriverFactory.GetDefaultBrowser(); SeleniumUtilities.SetTimeouts(driver); WebDriverWait wait = SeleniumConfig.GetWaitDriver(newDriver); Assert.AreEqual(wait.Timeout.TotalMilliseconds.ToString(), Config.GetValueForSection("SeleniumMaqs", "BrowserTimeout", "0")); } finally { try { driver?.KillDriver(); } finally { newDriver?.KillDriver(); } } }
public void SetTimeoutsGetWaitDriver() { SeleniumConfig.SetTimeouts(SeleniumConfig.Browser()); WebDriverWait wait = SeleniumConfig.GetWaitDriver(SeleniumConfig.Browser()); Assert.AreEqual(wait.Timeout.TotalMilliseconds.ToString(), Config.GetValue("Timeout", "0")); }
/// <summary> /// Reset the WebDriverWait to the default /// </summary> /// <param name="searchContext">Web driver or element</param> /// <example> /// <code source = "../SeleniumUnitTesting/SeleniumUnitTest.cs" region="ResetWaitDriver" lang="C#" /> /// </example> public static void ResetWaitDriver(this ISearchContext searchContext) { // Make sure we have the base driver and not the event firing wrapper IWebDriver unwrappedDriver = GetLowLevelDriver(searchContext); WebDriverWait waiter = SeleniumConfig.GetWaitDriver(unwrappedDriver); waitCollection.AddOrUpdate(unwrappedDriver, waiter, (oldkey, oldvalue) => waiter); }
public void GetWaitDriverResetWaitDriver() { WebDriverWait defaultWaitDriver = SeleniumConfig.GetWaitDriver(this.WebDriver); // default waitdriver this.WebDriver.ResetWaitDriver(); WebDriverWait resetWaitDriver = this.WebDriver.GetWaitDriver(); // webdrivers default webdriver Assert.AreEqual(defaultWaitDriver.Timeout, resetWaitDriver.Timeout); Assert.AreEqual(defaultWaitDriver.Message, resetWaitDriver.Message); Assert.AreEqual(defaultWaitDriver.PollingInterval, resetWaitDriver.PollingInterval); }
public void GetWaitDriver() { #region WaitDriver WebDriverWait wait = SeleniumConfig.GetWaitDriver(SeleniumConfig.Browser()); #endregion WaitDriver Assert.AreEqual(wait.Timeout.Seconds, 10); Assert.AreEqual(wait.PollingInterval.Seconds, 1); }
public void GetWaitDriver() { IWebDriver driver = WebDriverFactory.GetDefaultBrowser(); try { WebDriverWait wait = SeleniumConfig.GetWaitDriver(driver); Assert.AreEqual(20, wait.Timeout.Seconds); Assert.AreEqual(1, wait.PollingInterval.Seconds); } finally { driver?.KillDriver(); } }
/// <summary> /// Get the WebDriverWait /// </summary> /// <param name="searchContext">Web driver or element</param> /// <returns>The WebDriverWait</returns> /// <example> /// <code source = "../SeleniumUnitTesting/SeleniumUnitTest.cs" region="GetWaitDriver" lang="C#" /> /// </example> public static WebDriverWait GetWaitDriver(this ISearchContext searchContext) { // Make sure we have the base driver and not the event firing wrapper IWebDriver unwrappedDriver = GetLowLevelDriver(searchContext); if (waitCollection.ContainsKey(unwrappedDriver)) { return(waitCollection[unwrappedDriver]); } else { WebDriverWait waiter = SeleniumConfig.GetWaitDriver(unwrappedDriver); waitCollection.AddOrUpdate(unwrappedDriver, waiter, (oldkey, oldvalue) => waiter); return(waiter); } }