title: Catching Timeout exception in selenium
body: <p>So i'm working with PhantomJS webdriver in c# winforms.</p>
  
  <p>Unlike firefox PhantomJS will contiune in the code even if the webpage isn't completely loaded so in order to make sure it runs when it is completely loaded you have to check for elements and check if the page is completely loaded.</p>
  
  <pre><code>IWait&lt;IWebDriver&gt; wait = new OpenQA.Selenium.Support.UI.WebDriverWait(driver, TimeSpan.FromSeconds(30.00));
  try
   {
       wait.Until(driver1 =&gt; IsElementPresent(By.XPath("//*[@class='single_like_button btn3-wrap']")));
   }
   catch (TimeoutException) 
   {
        driver.Url = "http://addmefast.com/free_points/facebook_post_like";
   }
  </code></pre>
  
  <p>The error I got</p>
  
  <pre><code>An unhandled exception of type 'OpenQA.Selenium.WebDriverTimeoutException' occurred in  WebDriver.Support.dll
  
  Additional information: Timed out after 30 seconds 
  </code></pre>
  
  <p>Obviously the try and catch method didn't work above any other way to do this? </p>