title: Getting ElementNotVisibleException : Using Selenium WebDriver in MakeMyTrip.com for Date Picker
body: <p>I want to click a particular date in makemytip.com. I have written the below code. Everything works fine. Except I am unable to select the date. I can navigate to the month which ever I want but not able to select the date. Thanks for the help in advance.</p>
  
  <p>when I run the below program, I get the following error</p>
  
  <p>Exception in thread "main" org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with</p>
  
  <pre><code>package com;
  
  import java.text.ParseException;
  import java.text.SimpleDateFormat;
  import java.util.Date;
  import java.util.concurrent.TimeUnit;
  
  import org.openqa.selenium.By;
  import org.openqa.selenium.WebDriver;
  import org.openqa.selenium.firefox.FirefoxDriver;
  
  public class Calendar_MMT {
      static WebDriver d;
      public static void main(String[] args) throws ParseException {
       d = new FirefoxDriver();
       d.manage().window().maximize();
          d.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
          d.get("http://makemytrip.com");
          d.findElement(By.xpath("//*[@id='start_date_sec']/span[1]/span[1]")).click();
      selectDate("02/03/2016");
      }
  
  
      public static void selectDate(String date) throws ParseException{
          SimpleDateFormat df=new SimpleDateFormat("dd/MM/yyyy");
          Date dateToBeSelected = df.parse(date);
          Date currentDate = new Date();
          String monthYearDisplayed = d.findElement(By.xpath("//*[@id='ui-datepicker-div']/div[1]/div/div")).getText();
          System.out.println(monthYearDisplayed);
  
          String month = new SimpleDateFormat("MMMM").format(dateToBeSelected);
          String year = new SimpleDateFormat("yyyy").format(dateToBeSelected);
          String day = new SimpleDateFormat("d").format(dateToBeSelected);
          String monthYearToBeSelected = month+" "+year;
          System.out.println(monthYearToBeSelected);
  
          while(true){
          if(monthYearToBeSelected.equals(monthYearDisplayed)){
  
  // I FEEL BELOW LINE HAS PROBLEM
                  d.findElement(By.xpath("//a[text()='"+day+"']")).click();
                  System.out.println("Found and Selected");
                  break;
  
              }else{ //navigate to correct month and year
                  if(dateToBeSelected.after(currentDate)){
                      d.findElement(By.xpath("//*[@id='ui-datepicker-div']/div[2]/div/a/span")).click();
                  }else{
                      d.findElement(By.xpath("//*[@id='ui-datepicker-div']/div[1]/div/a/span")).click();
                  }
  
              }
              monthYearDisplayed = d.findElement(By.xpath("//*[@id='ui-datepicker-div']/div[1]/div/div")).getText();
          }
      }
      }
  </code></pre>