public static IWebElement FindElementWithRetry(this IWebDriver driver, By by, RetryPolicyFactory policyFactory) { return(policyFactory.CreateConfiguredRetryPolicy <NoSuchElementException, IWebElement>( (elem) => !elem.Displayed) .Execute(() => { var result = driver.FindElement(by); return result; })); }
public static ReadOnlyCollection <IWebElement> FindElementsWithRetry(this IWebDriver driver, By by, RetryPolicyFactory policyFactory) { return(policyFactory.CreateConfiguredRetryPolicy <NoSuchElementException, ReadOnlyCollection <IWebElement> >( (collection) => collection.Count == 0) .Execute(() => { var result = driver.FindElements(by); return result; })); }