Why Func instead of Predicate?

While Predicate has been introduced at the same time that List<T> and Array<T>, in .net 2.0, the different Func and Action variants come from .net 3.5. So those Func predicates are used mainly for consistency in the LINQ operators. As of .net 3.5, about using Func<T> and Action<T> the guideline states: Do use the new … Read more

Delegates: Predicate vs. Action vs. Func

Predicate: essentially Func<T, bool>; asks the question “does the specified argument satisfy the condition represented by the delegate?” Used in things like List.FindAll. Action: Perform an action given the arguments. Very general purpose. Not used much in LINQ as it implies side-effects, basically. Func: Used extensively in LINQ, usually to transform the argument, e.g. by … Read more

How to wait until an element is present in Selenium?

You need to call ignoring with exception to ignore while the WebDriver will wait. FluentWait<WebDriver> fluentWait = new FluentWait<>(driver) .withTimeout(30, TimeUnit.SECONDS) .pollingEvery(200, TimeUnit.MILLISECONDS) .ignoring(NoSuchElementException.class); See the documentation of FluentWait for more info. But beware that this condition is already implemented in ExpectedConditions so you should use WebElement element = (new WebDriverWait(driver, 10)) .until(ExpectedConditions.elementToBeClickable(By.id(“someid”))); *Update for … Read more