power_settings_new

i need example to fluent wait with package import

by
asked
0 votes
261 views
I have got plunty of examples to implement fluent wait, but I have not seen example with what are the package to be imported. Kindly post list of packages to be imported with fluent wait

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

1 Answer

answered by
selected by
0 votes
 
Best answer

Packages to be imported:

import java.util.concurrent.TimeUnit;
 
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.StaleElementReferenceException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.FluentWait;
import org.openqa.selenium.support.ui.Wait;
 
import com.google.common.base.Function;
 
Wait sample:
 
Wait<WebDriver> wait
= new FluentWait<WebDriver>(driver)
.withTimeout(60, TimeUnit.SECONDS)
.pollingEvery(5, TimeUnit.SECONDS)
.ignoring(NoSuchElementException.class)
.ignoring(StaleElementReferenceException.class);
 
WebElement eleVendorId =
wait.until(new Function<WebDriver, WebElement>() {
 
public WebElement apply(WebDriver driver) {
return driver.findElement(byvendor_id);
}
});
 
 
 
add
...