title: Selenium - webdriver Test if-else loop stuck/error
body: <p>I am trying to fill up a dynamic from which is automatically generated with user info. So I want to set if else condition for field of the from. So i use if else loop in step defenition but suppose if condition true its ok the code excute but if "if condition fail the code stuck in else loop why.Please help</p>
  
  <p>The code is below</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code> @And("^Input Height in add report$")
   public void Input_Height_in_add_report(DataTable newHeight) throws Throwable {
    
    
    if(driver.findElement(By.xpath("//label//span[contains(text(),'Height')]")).isDisplayed()){
     Thread.sleep(2000);
     List&lt;List&lt;String&gt;&gt; data = newHeight.raw();
     driver.findElement(By.xpath("/html/body/div[1]/div/div/div[2]/form/div[7]/div[1]/div/div/input")).sendKeys(data.get(1).get(1));
      }
    else{
     
    }
   
   }</code></pre>
  </div>
  </div>
  </p>