Hi Shruti, here's the automation script for handling calendar on a webpage using Selenium Webdriver:
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class CalendarHandling {
public static void main(String[] args)
{
System.setProperty("webdriver.gecko.driver","C:\\Users\\Abha_Rathour\\Downloads\\ExtractedFiles\\geckodriver-v0.24.0-win64\\geckodriver.exe");
WebDriver driver=new FirefoxDriver();
driver.get("https://jqueryui.com/datepicker/");
driver.findElement(By.id("datepicker")).click();
List<WebElement> allDates=driver.findElements(By.xpath("//table[@class='ui-datepicker-calendar']//td"));
for(WebElement ele:allDates)
{
String date=ele.getText();
if(date.equalsIgnoreCase("28"))
{
ele.click();
break;
}
}
}
}