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
4,325 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
• 27,920 points
Excellent, that was so helpful

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,030 points
563 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
598 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

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,510 points
2,538 views
0 votes
1 answer
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,870 points
2,022 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,870 points
2,106 views
0 votes
1 answer
0 votes
1 answer