title: How to select current date from dynamic calendar in Selenium?
body: <p>The calendar display date from current to next upcoming date. i need to select current date when every time I run the script. </p>
  
  <p>Calendar looks like this: <a href="https://www.screencast.com/t/EWjncok2Anv" rel="nofollow noreferrer">https://www.screencast.com/t/EWjncok2Anv</a></p>
  
  <p>I tried with below code, but didn't help me:</p>
  
  <pre><code>     DateFormat dateFormat2 = new SimpleDateFormat("dd"); 
       Date date2 = new Date();
  
       String today = dateFormat2.format(date2); 
  
       //find the calendar
       WebElement dateWidget = driver.findElement(By.id("qs_startdate"));  
       List&lt;WebElement&gt; columns=dateWidget.findElements(By.tagName("div"));  
  
       //comparing the text of cell with today's date and clicking it.
       for (WebElement cell : columns)
       {
          if (cell.getText().equals(today))
          {
             cell.click();
             break;
          }
       } 
  </code></pre>