Selecting date from a date picker

Hello Guys on my web page there is a date picker and in order to select any date from the date picker this element doesn’t have neither ID nor XPATH when I inspected the element using the FirePath as shown in the below screenshot. If I need to select date from the table then at least the date picker should be selected right? In this scenario even though I selected the date and checked in the HTML code there is nothing to identify the date neither ID nor HREF (so that I can use LinkText). Please advice me how can I select the date from the table now? If there is a class name specified for the date as in the screenshot which locator shall I use to find the element? When I did System.out.println to display the date it is picking correctly. But not able to detect the date element from the date picker.

Selecting date from a date picker

This is my code sample just for selecting the date

//DatePicker is a table.So we have to navigate to each cell
//This is the xpath of calender
WebElement datepicker = driver.findElement(By.xpath(“html/body/div[1]”));
List<WebElement> rows=datepicker.findElements(By.tagName(“tr”));
List<WebElement> columns=datepicker.findElements(By.tagName(“td”));

for (WebElement cell: columns){
//Select 20th Date
if (cell.getText().equals(“20″)){


KG Train Asked on September 10, 2015 in Selenium WebDriver.
Add Comment
1 Answer(s)

Use relative xpath

for example 12

I’ve just input needed date to input field)

victor Reviewer Answered on September 10, 2015.
Add Comment

Your Answer

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