Hi Ashish, The program is exceuting fine but not clicking exact date when my selectDate -12/3/2016 equals to current date -12/3/2016 Could you please help me.Thank you in advance.
SimpleDateFormat df = new SimpleDateFormat("MM/dd/yyyy"); Date dateToBeSelected = df.parse(date); Date currentDate = new Date(); String monthYearDisplayed = driver.findElement( By.xpath("//*[@id='ui-datepicker-div']/div[1]/div/div")) .getText(); System.out.println("month year displayed " + monthYearDisplayed); String month = new SimpleDateFormat("MMMM").format(dateToBeSelected); String year = new SimpleDateFormat("yyyy").format(dateToBeSelected); String day = new SimpleDateFormat("d").format(dateToBeSelected); System.out.println("day is " + day); String monthYearToBeSelected = month + " " + year; System.out .println("month year to be selected " + monthYearToBeSelected);
while (true) { if (monthYearToBeSelected.equals(monthYearDisplayed)) {
driver.findElement(By.xpath("//td/a[text()=" + day + "]")) .click(); System.out.println("found and selected"); break;
} else { if (dateToBeSelected.after(currentDate)) {