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

0 votes
How to Select date from a datepicker with Selenium Webdriver using Python?
Jul 31, 2019 in Selenium by Yashim
7,813 views

1 answer to this question.

0 votes

Hi Yashim, you can select date from a datepicker using following piece of code:

driver = webdriver.FirefoxDriver();

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

driver.switchTo().frame(0);

driver.implicitly_wait(2)
driver.maximize_window()

driver.findElement(By.id("datepicker")).click();
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);

dateWidget = driver.find_element_by_id("ui-datepicker-div")
rows = dateWidget.find_elements_by_tag_name("tr")
columns = dateWidget.find_elements_by_tag_name("td")

for cell in columns:
    if cell.gettext().equal('10'):
        cell.find_element_by_link_text('10').click()
        break


This should work.

To know more, It's recommended to join our Python Training in Chennai today.

answered Jul 31, 2019 by Abha
• 28,060 points

edited Oct 7 by Sarfaraz

Related Questions In Selenium

0 votes
1 answer
0 votes
2 answers
0 votes
1 answer

How to login a forum using Selenium with Python

You should try to directly log in ...READ MORE

answered Apr 27, 2018 in Selenium by Samarpit
• 5,890 points
1,295 views
0 votes
2 answers

How to open a browser window in full screen using Selenium WebDriver with C#

Hi , we have inbuilt method Maximize(). driver.Manage().Wind ...READ MORE

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

Installing Selenium Webdriver with Python package

Hey Hemant, for installing Selenium Webdriver with ...READ MORE

answered May 8, 2019 in Selenium by Anvi
• 14,150 points
8,305 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
6,227 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
6,584 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
4,212 views
0 votes
1 answer

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

Hey Jeevika, you can use following automation ...READ MORE

answered Jul 15, 2019 in Selenium by Abha
• 28,060 points
10,100 views
+1 vote
4 answers

How to get typed text from a textbox by using Selenium Webdriver?

Hey Ashmita, to get the typed text ...READ MORE

answered Jun 25, 2019 in Selenium by Abha
• 28,060 points
24,126 views