Disclaimer: I am relatively new to selenium and Java.
I have gone through the selenium source code and found that WebDriverWait extends FluentWait<WebDriver>
and FluentWait<T> implements Wait<T>
Doesn't that make WebDriverWait the Superset which has all the methods of FluentWait and Wait class? So my quesiton is:
What is wrong(in my understanding) or what is the difference in the below code.
WebDriverWait:(below)
WebDriverWait wait = new WebDriverWait(driver, 30);
wait.ignoring(NoSuchElementException.class);
wait.ignoring(StaleElementReferenceException.class);
wait.ignoring(ElementClickInterceptedException.class);
FluentWait:(below)
FluentWait<WebDriver> fluentWait = new FluentWait<WebDriver>(driver)
.withTimeout(30, TimeUnit.SECONDS)
.pollingEvery(5, TimeUnit.SECONDS)
.ignoring(NoSuchElementException.class)
.ignoring(StaleElementReferenceException.class)
.ignoring(ElementClickInterceptedException.class);
What I am try to have is a wait object which ignores these three exceptions.
NoSuchElementException
StaleElementReferenceException
ElementClickInterceptedException
Any help is appreciated. Thanks in advance.