Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
514 views
in Test Automation by
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

1 Answer

0 like 0 dislike
by
selected by
 
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);
}
});
 
 
 


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

...