title: How to check current date and move to next date
body: <p>I'm having a python issue which I cannot seem to understand. Not sure if I need to use if statements but because I'm new to python, I'm not actually sure how to code this little issue.</p>
  
  <p>Virtually this is the issue I have. For the departure calendar, I want python to be able to do the following:</p>
  
  <ul>
  <li>View 'Your date'. If there's a flight (doesn't matter if lowfare or normal), click it. If not then move onto the next available date that does have a flight and click that.</li>
  <li>Will need to be able to move to the next month if no date is available in the current month (I have an example code for this).</li>
  </ul>
  
  <p>For the return calendar, I want it to do the same thing but ensure it selects a date at least 7 days after the selected departure date.</p>
  
  <p>That's virtually my question, how to do that?</p>
  
  <p>Below is the html of the depature calendar (return calendar is exactly the same except it's inboundsearchresults rather than outbound search results):</p>
  
  <p>Below I have a sample code which works when selecting from an ordinary date picker (this is used in the page before the url) if you want to use that template and manipulate it:</p>
  
  <pre><code># select depart date
  datepicker = driver.find_element_by_id("departure-date-selector")
  actions.move_to_element(datepicker).click().perform()
  
  # find the calendar, month and year picker and the current date
  calendar = driver.find_element_by_id("departureDateContainer")
  month_picker = Select(calendar.find_element_by_class_name("ui-datepicker-month"))
  year_picker = Select(calendar.find_element_by_class_name("ui-datepicker-year"))
  current_date = calendar.find_element_by_class_name("ui-datepicker-current-day")
  
  # printing out current date
  month = month_picker.first_selected_option.text
  year = year_picker.first_selected_option.text
  print("Current departure date: {day} {month} {year}".format(day=current_date.text, month=month, year=year))
  
  # see if we have an available date in this month
  try:
      next_available_date = current_date.find_element_by_xpath("following::td[@data-handler='selectDay' and ancestor::div/@id='departureDateContainer']")
      print("Found an available departure date: {day} {month} {year}".format(day=next_available_date.text, month=month, year=year))
      next_available_date.click()
  except NoSuchElementException:
  # looping over until the next available date found
          while True:
  # click next, if not found, select the next year
              try:
                  calendar.find_element_by_class_name("ui-datepicker-next").click()
              except NoSuchElementException:
  # select next year
                  year = Select(calendar.find_element_by_class_name("ui-datepicker-year"))
                  year.select_by_visible_text(str(int(year.first_selected_option.text) + 1))
  
  # reporting current processed month and year
                  month = Select(calendar.find_element_by_class_name("ui-datepicker-month")).first_selected_option.text
                  year = Select(calendar.find_element_by_class_name("ui-datepicker-year")).first_selected_option.text
                  print("Processing {month} {year}".format(month=month, year=year))
  
              try:
                  next_available_date = calendar.find_element_by_xpath(".//td[@data-handler='selectDay']")
                  print("Found an available departure date: {day} {month} {year}".format(day=next_available_date.text, month=month, year=year))
                  next_available_date.click()
                  break
              except NoSuchElementException:
                  continue
  </code></pre>