title: How to fail the test if Element is found and pass the test if element is not found?
body: <p>I have to develop a unit test which fails if element is present and passes the test if element is not present. </p>
  
  <p>To be detailed, I have a simple form like name, email, address etc. When I click on the save button, error message is displayed if required fields are empty. If error message is displayed then I have to fail the test and if not displayed then pass the test. Is there any solution?</p>
  
  <pre><code>try
  {
  //Click on save button
              IWebElement save_profile = driver.FindElement(By.XPath("//div[@class='form-group buttons']/div/input"));
              save_profile.Click();
  //Locate Error Message below the text box
              IWebElement FirstNameError = driver.FindElement(By.XPath("//form[@class='default form-horizontal']/fieldset/div[4]/div[2]/span/div"));
  //I want to fail the test here if above element is found 
  }
  catch
  {
  //pass the test if element is not found in try statement
  }
  </code></pre>
  
  <p>I think I am going in the wrong direction but couldn't find the solution. Please advice. Thansk in advance.</p>