title: Selenium webdriver to select date
body: <p>I am newbie to Selenium and not able to select date website <a href="http://www.redbus.in" rel="nofollow">http://www.redbus.in</a>.
  Can some one help me out? I tried to pass value to the read only text box, but it was in vain.</p>
  
  <pre><code>public static void setup() throws Exception {
      System.out.println("Browser Set up start.. ");
      driver = new FirefoxDriver();
      driver.manage().window().maximize();
      driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);
      driver.get("http://www.redbus.in/");
      System.out.println("Browser Set up Completed ");
  }
  
  @Test
  public static void SelectSrcDest() throws Exception {
      System.out.println("Constructing Url to open");
  
      driver.findElement(By.id("txtSource")).sendKeys("Bangalore");
      driver.findElement(By.id("txtDestination")).sendKeys("Chennai");
  
  
      driver.findElement(By.xpath("html/body/div[2]/div/section/div[1]/img")).click();
      driver.findElement(By.xpath("html/body/div[2]/div/section/div[1]/img")).click();
  
      JavascriptExecutor executor = (JavascriptExecutor)driver;
      executor.executeScript("window.document.getElementById('txtOnwardCalendar').setAttribute('value','27-Mar-2014')");
      driver.findElement(By.xpath("html/body/div[2]/div/section/div[4]/button")).click();
  }
  
  public static void main(String[] args) throws Exception {
      // TODO Auto-generated method stub
  
      setup();
      SelectSrcDest();
  }
  </code></pre>