title: Selenium implicit and explicit wait, timeout exception element not found
body: <p>I am new to selenium (but experienced java developer).</p>
  
  <p>I am using something like below:</p>
  
  <pre><code>WebElement searchBasket = pDriver.findElement(By.xpath("//a[contains(.,'Search&amp;Baskets')]"));
  WebElement searchproduct = pDriver.findElement(By.xpath("//a[contains(.,'Search a product')]"));
  
  //if search an agreement is not show up, then click on other menu, then click it back
  pWait.until(ExpectedConditions.elementToBeClickable(By.xpath("//a[contains(.,'Search&amp;Baskets')]")));
  pDriver.findElement(By.xpath("//a[contains(.,'Search&amp;Baskets')]")).click();
  
  // click on search an agreement
  try {
      pWait.until(ExpectedConditions.elementToBeClickable(By.xpath("//a[contains(.,'Search&amp;Baskets')]")));
      action = new Actions(pDriver);
      action.moveToElement(searchBasket).build().perform();
  
      pWait.until(ExpectedConditions.elementToBeClickable(By.xpath("//a[contains(.,'Search a product')]")));
      searchproduct.click();
  } catch (TimeoutException e) {
  }
  </code></pre>
  
  <p>where pWait is:</p>
  
  <pre><code>WebDriverWait wait = new WebDriverWait(driver, 15);
  </code></pre>
  
  <p>however when I run the test case I get below error:</p>
  
  <pre><code>Unable to locate element: {"method":"xpath","selector":"//a[contains(.,'Search&amp;Baskets')]"}
  Command duration or timeout: 4 milliseconds
  </code></pre>
  
  <p>I thought it should have wait atleast 15 seconds before throwing this exception. From the log above it looks like it threw exception only in 4ms. 
  and i could see on console that as soon as it hit that line, it threw exception.</p>
  
  <p>I have implicit waiting set as 0 and using explicit wait.</p>
  
  <p>Am i missing anything here.</p>
  
  <p>Also, in explicit and implicit wait, is it upto that much time OR exact that much time, 
  example if I set implicit wait as 10 sec, then does it mean wait for exact 10 sec OR wait upto 10 sec (if element found then proceed, even if element founf on 6th second)</p>
  
  <p>is above same for explicit wait as well?</p>
  
  <p>Please help</p>