title: How to handle conditions in selenium Xpath
body: <p>I am searching for a text in a table in web view, if text does not exist it should go to else and perform my operations accordingly, Instead of this, it throws an exception of NoSuchElementException. How to handle this. what Web drivers return a values when data is not found for comparison. </p>
  
  <p>Note: this works fine if it find the matching value of <code>title</code> variable in table</p>
  
  <pre><code>WebElement table = driver.findElement(By.xpath("html/body/form/div[6]/div/div[1]/div[2]/fieldset/div[1]/div/div[1]/div/table"));
  
  // find the row
  WebElement customer = table.findElement(By.xpath("//tbody/tr/td[contains(text(), '"+title+"')]/following-sibling::td/a[text()='Detail']"));
  if(customer != null){ // how do I compare here.
      //System.out.println("This is your TITLE " +customer.getText());
      }else{
  // my further code for failed case. 
  }
  </code></pre>