RE: Date picker script for the below scenario ?

7 Answers

Hi Anu,

Here’s the solution…

…….

 

WebElement dateWidget = driver.findElement(By.id("ui-datepicker-div"));
Thread.sleep(1000);
Select month = new Select(driver.findElement(By.className("ui-datepicker-month")));
 month.selectByValue("0");
Thread.sleep(1000);
 Select year = new Select(driver.findElement(By.className("ui-datepicker-year")));
 year.selectByValue("2018");
Thread.sleep(1000);
 List<WebElement> rows=dateWidget.findElements(By.tagName("th"));
 List<WebElement> columns=dateWidget.findElements(By.tagName("td"));
for (WebElement cell: columns)
 {
 //Select 17th Date
 if (cell.getText().equals("17"))
 {
 cell.findElement(By.linkText("17")).click();
 break;
 }
 }

 

……………….

Train Answered on September 4, 2014.

Thank you Paso007

on October 13, 2014.
Add Comment

Your Answer

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