Thursday, November 6, 2014

How to select a value from Calendar using Selenium Webdriver

 


First  need find css for calendar object

css=label[id='flight-departing-label']>span.icon.icon-calendar.

driver.findElement(By.cssSelector("input#flight-type-roundtrip")).click();

1. Verify month

 driver.findElement(By.cssSelector("div.cal>section.cal-month:first-of-type>header>h2")).getText();

It will return the month  Nov 2014

2.Select the day 

driver.findElement(By.cssSelector("div.cal>section.cal-month:first-of-type>ul>li>a[data-day='6']")).click();

3. Clicking next month like Jan 2015

driver.findElement(By.cssSelector("button[class='btn-paging btn-secondary next']")).click();