Beispiel #1
0
        public static TPage RefreshUntil <TPage>(this BrowserForTests browser, TPage page, Func <TPage, bool> conditionFunc, string cause = null, int timeout = 65000, int waitTimeout = 100)
            where TPage : PageBase
        {
            var w = Stopwatch.StartNew();

            if (conditionFunc(page))
            {
                return(page);
            }
            do
            {
                page = browser.Refresh(page);
                if (conditionFunc(page))
                {
                    return(page);
                }
                Thread.Sleep(waitTimeout);
            } while (w.ElapsedMilliseconds < timeout);
            Assert.Fail(cause ?? $"Не смогли дождаться страницу за {timeout} мс");
            return(default);
Beispiel #2
0
 public static TPage Refresh <TPage>(this BrowserForTests browser, TPage page)
     where TPage : PageBase
 {
     browser.WebDriver.Navigate().Refresh();
     return(browser.GoTo <TPage>());
 }