Assuming ur date picker calendar is in table format
you can use:
public void checkDate(){
String currentDate = null;
int counter=0;
WebElement tab = driver.findElement(By.id("tabid"));
List<WebElement> rows= tab.findElements(By.tagName("tr"));
for(int i =0;i<=rows.size()-1;i++){
List<WebElement> columns=rows.get(i).findElements(By.tagName("td"));
Iterator itr = columns.iterator();
while(itr.hasNext()){
WebElement we=(WebElement) itr.next();
if(we.getText().equals(currentDate)){
break;
}
counter=counter+1;
}
//element to be clicked is +1 to c
driver.findElement(By.cssSelector("tr:nth-child(i) li:nth-child(counter+1)")).click();
}
PS. This should serve your purpose but you need to handle the case when your current date is in last column of the table.
UPDATE:
String currDate= driver.findElement(By.cssSelector("table#dp_cal_calendar table.cells td.wkday.curdate")).getText();
int dateToBeSelected = Integer.parseInt(currDate) + //no of days you want to add ;
WebElement currentDate = driver.findElement(By.xpath("//table[@id='dp_cal_calendar']//table[@class='cells']//td[contains(text(),'"+String.valueOf(dateToBeSelected) +"')]")).click();
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…