Search code examples
pythonselenium-webdriverselenium-chromedriverwebdriver

Python Selenium Choose date from a Datepicker Calendar


I want to select a date (dd/mm/yyyy) from a Datepicker calendar

enter image description here

So I used the following code, which doesn't display an error but doesn't work on the browser (I don't have the date selected that I'm looking for).

dateDebut=driver.find_element(By.XPATH ,'XPATH on Browser') #here I copied the XPATH on browser
dateDebut.send_keys('01/01/2021')#I have no error, but the date on the browser is not "01/01/2021"

Any thoughts which can point me in the right direction would be great. Thanks.


Solution

  • dateDebut.get_property('value')
    dateDebut.clear() 
    dateDebut.send_keys("01/01/2021")