title: Testing a negative flow in Selenium webdriver
body: <p><strong>Issue:-</strong> webelement (Button) isdisplayed() doesn't works for negative scenarios</p>
  
  <p><strong>Requirement:-</strong> I need to fail a test flow in case a button is not displayed on the screen and if its present, then proceed with the flow </p>
  
  <p><strong>Code:-</strong></p>
  
  <pre><code>if (driver.findElement(By.id("button")).isDisplayed() == false) {
  System.out.println("The Button isn't present. Exiting!!");
  driver.findElement(By.linkText("Logout")).click();
  }
  else
  {
  //Proceed with the positive flow
  }
  </code></pre>
  
  <p>In above code, if the button is not present at all on the screen, the test should fail (if statement should be executed, but it's not)</p>