Example #1
0
        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");
            }
        }
Example #2
0
 public static void TurnOff(this IWebDriver driver, WaitEnum waitEnum)
 {
     SetWait(driver, waitEnum, TimeSpan.Zero);
 }
Example #3
0
 public static void SetDefault(this IWebDriver driver, WaitEnum waitEnum)
 {
     SetWait(driver, waitEnum, DefaultWaitMs);
 }
Example #4
0
 public static void TurnOn(this IWebDriver driver, WaitEnum waitEnum, int ms)
 {
     SetWait(driver, waitEnum, TimeSpan.FromMilliseconds(ms));
 }