Reputation: 1
<input placeholder="MM/DD/YYYY" autocomplete="on" type="text" class="form-control" value="01/01/2020" style="height: 40px; color: (25, 25, 25); font-weight: bold; font-size: 14px; background: >
error: Message: element not interactable
Upvotes: 0
Views: 1447
Reputation: 969
This is my python script for date picker. Hope this can be useful in someways.
from selenium import webdriver
#set chromodriver.exe path
driver = webdriver.Chrome(executable_path="C:\\chromedriver.exe")
driver.implicitly_wait(0.5)
#launch URL
driver.get("https://jqueryui.com/datepicker/")
#switch to frame
l = driver.find_element_by_xpath("//iframe[@class='demo-frame']")
driver.switch_to.frame(l);
#identify element inside frame
d= driver.find_element_by_id("datepicker")
d.click()
#identify list of all dates
m = driver.find_elements_by_xpath("//table/tbody/tr/td")
#iterate over list
for i in m:
#verify required date then click
if i.text == '3':
i.click()
break
#get selected date
s = d.get_attribute('value')
print("Date entered is: ")
print(s)
#browser quit
driver.quit()
Upvotes: 0
Reputation: 1352
Can you check this
#You can select the datepicker based on the XPath index [1][2]
date_input = driver.find_element_by_xpath('((//input[@type='text']))')
date_input.click()
date_input.send_keys(Keys.CONTROL, "a")
date_input.send_keys(Keys.BACKSPACE)
date_input.send_keys("02/14/2020",Keys.RETURN)
Upvotes: 1