Showing posts with label Implicit Wait. Show all posts
Showing posts with label Implicit Wait. Show all posts

Wednesday, 16 January 2013

Wait Statement in Selenium Webdriver

Wait Statement in Selenium Webdriver

There are two types of Wait Statement:
1. Implicit Wait
2. Explicit Wait

Implicit Wait:

An Implicit Wait is to tell the Webdriver to wait for a particular seconds

WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

In this scenario, Webdriver will wait for 10 seconds.


Explicit Wait:

wait.until(ExpectedConditions.visibilityOf(By.xpath("//*@id='form1']/--------/img")));

In this scenario, Webdriver will wait upto the element is present.