How can I select date from a datepicker div using Selenium Webdriver

0 votes
How can I select date from a datepicker div using Selenium Webdriver?
Jul 15, 2019 in Selenium by Jeevika
12,153 views

1 answer to this question.

0 votes

Hey Jeevika, you can use following automation script to select a date from a datepicker div in Webdriver:

driver = new FirefoxDriver();

driver.get("http://jqueryui.com/datepicker/");

  driver.switchTo().frame(0);

  driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);

  driver.findElement(By.id("datepicker")).click();

  driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);

  WebElement dateWidget = driver.findElement(By.id("ui-datepicker-div"));

  List rows=dateWidget.findElements(By.tagName("tr"));

  List columns=dateWidget.findElements(By.tagName("td"));

  for (WebElement cell: columns){

   //Select 10th Date

   if (cell.getText().equals("10")){

   cell.findElement(By.linkText("10")).click();

   break;

   }

  }
answered Jul 15, 2019 by Abha
• 28,140 points
Excellent, that was so helpful
I think this solution is for the default calendar widget. How do you jump to a few months forward or backward? Would you post a solution, please?
Hey @Postak, could you please post your query as a separate question?

Related Questions In Selenium

0 votes
1 answer

How can I select an option from a dropdown using Ruby Selenium Webdriver?

Hey Swasti, you can try following lines ...READ MORE

answered Aug 26, 2019 in Selenium by Anvi
• 14,150 points
4,734 views
0 votes
1 answer

How can I locate web elements from a web page using Selenium Webdriver?

Hey @Dushyant, Locating elements in WebDriver is ...READ MORE

answered May 29, 2019 in Selenium by Shreya
2,882 views
–1 vote
1 answer
+1 vote
1 answer

Can I select multiple options from a dropdown using Python Selenium webdriver?

Hi Dhwani, you can use following code ...READ MORE

answered Jul 31, 2019 in Selenium by Abha
• 28,140 points
4,879 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
13,567 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,084 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
7,178 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,840 views
0 votes
1 answer

How to Select date from a datepicker with Selenium Webdriver using Python?

Hi Yashim, you can select date from ...READ MORE

answered Jul 31, 2019 in Selenium by Abha
• 28,140 points

edited Oct 7, 2021 by Sarfaraz 10,922 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP