private static void SetWait(IWebDriver driver, WaitEnum waitEnum, TimeSpan time) { switch (waitEnum) { case WaitEnum.Implicit: driver.Manage().Timeouts().ImplicitWait = time; break; case WaitEnum.PageLoad: driver.Manage().Timeouts().PageLoad = time; break; case WaitEnum.ExplicitWait: Thread.Sleep(time); break; default: throw new ArgumentOutOfRangeException(nameof(waitEnum), waitEnum, "No such enum type"); } }
public static void TurnOff(this IWebDriver driver, WaitEnum waitEnum) { SetWait(driver, waitEnum, TimeSpan.Zero); }
public static void SetDefault(this IWebDriver driver, WaitEnum waitEnum) { SetWait(driver, waitEnum, DefaultWaitMs); }
public static void TurnOn(this IWebDriver driver, WaitEnum waitEnum, int ms) { SetWait(driver, waitEnum, TimeSpan.FromMilliseconds(ms)); }