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
9,407 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,040 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
1,508 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 28, 2019 in Selenium by Shreya
1,335 views
–1 vote
1 answer
0 votes
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 30, 2019 in Selenium by Abha
• 28,040 points
2,217 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,520 points
5,105 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,010 points
5,837 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,890 points
3,599 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 2, 2020 in Selenium by Sri
• 3,010 points
4,341 views
0 votes
1 answer
0 votes
1 answer