title: C# Selenium Webdriver Count Xpath Elements / null check
body: <p>How would you convert the count of xpath to int?</p>
  
  <pre><code>int example = driver.FindElement(By.XPath("(//td[contains(@sorttable_customkey, '" + Account + "')])/preceding::a[1]")).Count;
  </code></pre>
  
  <p>I picked this up from question: <a href="https://stackoverflow.com/questions/14970977/does-anyone-know-why-getxpathcount-doesnt-work-in-c/14998668#14998668">Does anyone know why GetXpathCount() doesn&#39;t work in C#?</a></p>
  
  <p>I can't seem to get it to work, I tried dumping the above to a list and counting the list but this also wouldn't work.</p>
  
  <p>Also sort of off topic but is there a way to check if driver.FindElement(By.XPath("exp")) == null? because if it dose = null it will throw a null reference error. </p>