Example #1
0
 private IAssertion InnerAddWithPolicy(Func <IWebDriver, bool> func, string actionName)
 {
     _assertions.Add(new UtilityAction(actionName, driver => Policy
                                       .Handle <WebDriverException>()
                                       .Or <LocatorFindException>()
                                       .WaitAndRetry(
                                           _actionRetryCount,
                                           (tryNum) => RetryWaitCalculator.GetTimeSpanForWait(tryNum, _actionRetryWaitPeriods))
                                       .Execute(() => func(driver))));
     return(this);
 }
Example #2
0
 private IWait InnerAddWithPolicy(Func <IWebDriver, bool> action, string actionName)
 {
     _waits.Add(new UtilityAction(actionName, driver =>
     {
         return(Policy
                .Handle <WebDriverException>()
                .Or <LocatorFindException>()
                .WaitAndRetry(
                    _retryCount,
                    (tryNum) => RetryWaitCalculator.GetTimeSpanForWait(tryNum, _retryWaitPeriods))
                .Execute(() =>
         {
             return action(driver);
         }));
     }));
     return(this);
 }
Example #3
0
        private IExecution InnerAddWithPolicy(Action <IWebDriver> action, string actionName)
        {
            _actions.Add(new ExecutionAction(actionName, driver =>
            {
                Policy
                .Handle <WebDriverException>()
                .Or <LocatorFindException>()
                .WaitAndRetry(
                    _executionOptions.ActionRetries,
                    (tryNum) => RetryWaitCalculator.GetTimeSpanForWait(tryNum, _executionOptions.ActionRetryWaitPeriods))
                .Execute(() => action(driver));

                return(new ActionResult
                {
                    Context = new ExecutionContext
                    {
                        ActionName = actionName,
                        Url = driver.Url
                    }
                });
            }));
            return(this);
        }