title: Query related to Explicit wait: wait.until(ExpectedConditions.visibilityOfElementLocated(By.id(
body: <pre class="lang-java prettyprint-override"><code>package wait1;
  
  import org.openqa.selenium.By;
  import org.openqa.selenium.firefox.FirefoxDriver;
  import org.openqa.selenium.support.ui.ExpectedConditions;
  import org.openqa.selenium.support.ui.WebDriverWait;
  
  public class Explicit {
  
      public static void main(String[] args) {
          FirefoxDriver driver= new FirefoxDriver();
  
          WebDriverWait wait= new WebDriverWait(driver,20 );
  
          driver.get("http://www.91mobiles.com/");
          driver.findElement(By.xpath("//*[@id='q']")).sendKeys("Micromax");
  
          //wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='ui-id-22']/span[2]")));
  
          wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("id=ui-id-172")));
          driver.findElement(By.xpath("//*[@id='ui-id-52']")).click();
  
      }
  
  }
  </code></pre>
  
  <p>I am getting the following error when I execute the above script:</p>
  
  <pre><code>    Exception in thread "main" org.openqa.selenium.TimeoutException: Timed out after 20 seconds waiting for visibility of element located by By.id: id=ui-id-172
  Build info: version: '2.33.0', revision: '4e90c97', time: '2013-05-22 15:33:32'
  System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_25'
  Driver info: driver.version: unknown
      at org.openqa.selenium.support.ui.FluentWait.timeoutException(FluentWait.java:259)
      at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:228)
      at wait1.Explicit.main(Explicit.java:20)
  Caused by: org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"id","selector":"id=ui-id-172"}
  Command duration or timeout: 21 milliseconds
  For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
  Build info: version: '2.33.0', revision: '4e90c97', time: '2013-05-22 15:33:32'
  System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_25'
  Session ID: fd977506-2457-4981-a304-f9a9b6b57f4e
  Driver info: org.openqa.selenium.firefox.FirefoxDriver
  Capabilities [{platform=XP, databaseEnabled=true, cssSelectorsEnabled=true, javascriptEnabled=true, acceptSslCerts=true, handlesAlerts=true, browserName=firefox, browserConnectionEnabled=true, nativeEvents=true, webStorageEnabled=true, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=17.0.7}]
      at sun.reflect.GeneratedConstructorAccessor10.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      at java.lang.reflect.Constructor.newInstance(Unknown Source)
      at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:191)
      at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
      at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
      at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:307)
      at org.openqa.selenium.remote.RemoteWebDriver.findElementById(RemoteWebDriver.java:348)
      at org.openqa.selenium.By$ById.findElement(By.java:216)
      at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:299)
      at org.openqa.selenium.support.ui.ExpectedConditions.findElement(ExpectedConditions.java:522)
      at org.openqa.selenium.support.ui.ExpectedConditions.access$0(ExpectedConditions.java:520)
      at org.openqa.selenium.support.ui.ExpectedConditions$4.apply(ExpectedConditions.java:130)
      at org.openqa.selenium.support.ui.ExpectedConditions$4.apply(ExpectedConditions.java:1)
      at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:208)
      ... 1 more
  Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Unable to locate element: {"method":"id","selector":"id=ui-id-172"}
  Build info: version: '2.33.0', revision: '4e90c97', time: '2013-05-22 15:33:32'
  System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_25'
  Driver info: driver.version: unknown
  </code></pre>