title: Selenium unable to locate element using xpath but firebug can
body: <p>I have the following code to locate an element using a Xpath which using Firebug it works great. When I run my program I get the following exception:</p>
  
  <blockquote>
    <p>Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"xpath","selector":"(//div[@class=\" x-ignore x-menu x-component \"]//div)/a[text()=\"ID\"]"}</p>
  </blockquote>
  
  <p>If I take that exact xpath and stick in Firebug I can find my element no problem. Any ideas why Selenium can't find it?</p>
  
  <p>Here's my code:</p>
  
  <pre><code>public static void displayColumn(String column) throws Exception {
      String columnOptionsDropdownXpath = "(//div[@class=\"x-grid3-header\"]//span)[1]/../a";
      String columnXpath = "(//div[@class=\"x-grid3-header\"]//span)[1]";
      String columnsXpath = "(//div[@class=\" x-ignore x-menu x-component\"]//a)[3]";
      String columnToDisplayXpath = "(//div[@class=\" x-ignore x-menu x-component \"]//div)/a[text()=\"" + column + "\"]";
  
      // Because the 'column options' button doesn't appear until you hover over the column
      WebElement col = null;
      try {
          col = driver.findElement(By.xpath(columnXpath));
      } catch (NoSuchElementException e) {
          System.out.println("Column not found - is it displayed?");
      }
  
      Actions builder = new Actions(driver);
      builder.moveToElement(col).build().perform();
      WebElement element = driver.findElement(By.xpath(columnOptionsDropdownXpath));
      element.click();
      Thread.sleep(500);
  
      element = driver.findElement(By.xpath(columnsXpath));
      builder.moveToElement(element).build().perform();
      Thread.sleep(2000);
      WebDriverWait wait = new WebDriverWait(driver, 10);
      try {
          System.out.println("in try statement");
          wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(columnToDisplayXpath)));
      } catch (TimeoutException e) {}
  
      element = driver.findElement(By.xpath(columnToDisplayXpath));
      element.click();
  }
  </code></pre>