DesertDeveloper
DesertDeveloper

Reputation: 35

Scrolling through calendar and selecting a date

On this site, you cannot just send in a date, but it forces you to click on the date in the calendar picker, and for some reason I cannot solve it. Any ideas? Here is where I left off:

driver = webdriver.Firefox(executable_path="geckodriver")
driver.get("https://www.okcc.online/")
driver.maximize_window()
wait = WebDriverWait(driver, 10)

driver.find_element_by_xpath('//*[@id="rod-date-toggle"]').click()

wait.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="rod-date-toggle"]'))).send_keys("4/1/2020")

wait.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="rodToDateTxt"]'))).send_keys("4/10/2020")

search_button = driver.find_element_by_xpath('//*[@id="rod-submit-search"]').click()

Doesn't seem to A. send in keys. And when I did get this part solved, it doesn't work unless I click on the actual date in the calendar. Confusing!

Upvotes: 0

Views: 180

Answers (1)

mkhurmi
mkhurmi

Reputation: 816

After you enter a date in the box, you need to close the date-picker By sending Enter or Return keys:

YourElement.send_keys(Keys.RETURN)

Import package :

from selenium.webdriver.common.keys import Keys

Upvotes: 1

Related Questions