title: How to verify web element presence on the page using selenium 2
body: <p>I'm trying to implement a test using selenium web-driver 2 tool.</p>
  
  <p>Application has elements, which presence is unpredictable. Ok. In the most cases they are present on the page. But in the certain cases they aren't. The following method clicks the unpredictable element</p>
  
  <pre><code>public void clickTypeAheadDropdown(String typeAheadItem) {
      String xPathItemSelector = "//div[@class='gwt-SuggestBoxPopup']//td[text()='" + typeAheadItem + "']";
      WebElement dropDownItem = driver.findElement(By.xpath(xPathItemSelector));
      if (dropDownItem.isDisplayed() ) {
          dropDownItem.click();
      };
  
  }
  </code></pre>
  
  <p>but it fails when the element is absent. The exception is rised by the method <strong>driver.findElement(By.xpath(xPathItemSelector)</strong></p>
  
  <p>Do you know, how can I test, does element present on the page?</p>
  
  <p>P.S. I assume, that catching "Element Not Found" exception is not a good idea, because it is raised when test is out of time</p>