RE: Jquery Datepicker

I have the following code  but its not selecting the date:  it is printing the required date but not selecting on the web

 

sam Default Asked on February 20, 2015 in Selenium WebDriver.
Add Comment
3 Answers

Hi this is the website I am trying to code for Calendar :
www.rentalcars.com

I have this code in place

private void webpickDDate() {
WebElement webpickupdate = driver.findElement(webpickUpdateLocator);
webpickupdate.click();
Calendar cal = Calendar.getInstance();
WebElement next1 = driver.findElement(By.xpath(“//div[@id=’ui-datepicker-div’]/div/a[2]”));
next1.click();
WebElement next2 = driver.findElement(By.xpath(“//div[@id=’ui-datepicker-div’]/div/a[2]”));
next2.click();
WebElement next3 = driver.findElement(By.xpath(“//div[@id=’ui-datepicker-div’]/div/a[2]”));
next3.click();
cal.add(Calendar.DATE, 1);
cal.add(Calendar.MONTH, 3);
DateFormat df = new SimpleDateFormat(“dd/MM/YYYY”);
for (int i = 0; i <= 7;) {
int dayofweek = cal.get(Calendar.DAY_OF_WEEK);
if (dayofweek == Calendar.SUNDAY) {
cal.add(Calendar.DATE, +1);
String newdate = df.format(cal.getTime());
webpickupdate.sendKeys(newdate);
webpickupdate.click();
webpickupdate.sendKeys(Keys.RETURN);
System.out.println(newdate);
break;
} else {
String date = df.format(cal.getTime());
webpickupdate.isSelected();
//webpickupdate.isSelected();
webpickupdate.sendKeys(Keys.RETURN);
System.out.println(date);
break;
}
}
}

Default Answered on February 23, 2015.
Add Comment

Your Answer

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