implicitlyWait() method to wait time for WebElement load

implicitlyWait() method is used to wait the time for sometime to load the webelements on the web page.  It will automatically timeout the specified time once the time set is reached the limit.  Then, it will continue with the next line to execute the test automation scripts.

Below example is used to wait the time for 10 seconds.

Example Code:
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class ImplicitlyWait {
public static void main(String... args) {

WebDriver driver = new FirefoxDriver();

//Implicitly wait time is used to wait for sometime and then continue.
//10 second is used below for waiting time
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

driver.get("www.QaFreaks.com");
}
}

No comments:

Post a Comment

Socialize It and Share the post with your friends
SOCIALIZE IT →
FOLLOW US →
SHARE IT →