Hi Ashish,
I am trying to click on current month calendar date in Zoho CRM but i am not able to manage writing day into the xpath.
Can you please give me the xpath for the current month date inserting day into the xpath.
Thank you,
[code:2vb6wfyb] public void selectDate(String d) throws ParseException {
click("dateTextField_xpath");
SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
Date dateToBeSelected = df.parse(d);
Date currentDate = new Date();
String monthYearDisplayed = getText("monthYearDisplayed_xpath");
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/class[cdate text()='"+ day +"']"))
.click();
System.out.println("found and selected");
break;
} else {
if (dateToBeSelected.after(currentDate)) {
click("forward_xpath");
} else {
click("back_xpath");
}
}
monthYearDisplayed = getText("monthYearDisplayed_xpath");
}
}[/code:2vb6wfyb]