Current date calculation in selenium web driver

Here i need to select “From date” as current date and “To date” is next date …
In my calendar sundays are unselectable(disable) mode….canu u provide me a sample code for this scenario…for your reference  i will send the URL “”

Add Comment
2 Answer(s)

its very helpfull if u give me the proper code

balaji18s Train Answered on July 13, 2015.
Add Comment

Calendar cal = Calendar.getInstance();
int todayDate = cal.get(Calendar.DAY_OF_MONTH);
int tomorrowDate = todayDate+1;

String todayStr = String.valueOf(todayDate);
String tomorrowStr = String.valueOf(tomorrowDate);


WebElement start = driver.findElement(“hireFromDate”));;

WebElement today = driver.findElement(By.xpath(“.//*[@id=’ui-datepicker-div’]//a[contains(text(),'” + todayStr + “‘)]”));;

WebElement doneButton = driver.findElement(By.xpath(“.//button[contains(text(),’Done’)]”));;

WebElement end = driver.findElement(“hireToDate”));;

WebElement tomorrow = driver.findElement(By.xpath(“.//*[@id=’ui-datepicker-div’]//a[contains(text(),'”+tomorrowStr+”‘)]”));;

WebElement doneButtonEnd = driver.findElement(By.xpath(“.//button[contains(text(),’Done’)]”));;

And it will be last answer for you if you won’t mark this question as ANSWERED

And previous questions too.

victor Reviewer Answered on July 13, 2015.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.