I am very new to Python and learning how to scrap data with Selenium.
I encounter a problem when trying to pick a date from a datepicker form on monmondo.com (for the sake of example)
This is the farthest I managed to get: (edit: I managed to go a little further than before but I am still stuck)
from selenium import webdriver
browser = webdriver.Firefox()
browser.get("https://www.momondo.com")
browser.implicitly_wait(5)
date = browser.find_element_by_name("ctl00$Content$ctl04$SearchFormv8$SearchFormFlight$InputDepart").click()
browser.implicitly_wait(5)
test= browser.find_elements_by_xpath("//*['ui-datepicker-div']//td[@data-year='2017'][@data-month='2']/a[@class='ui-state-default'][@href='#'][text()='20']")
test[0].click()
Which results in
selenium.common.exceptions.ElementNotVisibleException: Message:
I've tester the xpath with firepath and it seems to work correctly as it is found in the page's source code.
The webpage structure of the calendar's day in the source code is:
<td class=" " data-handler="selectDay" data-event="click" data-month="2" data-year="2017"><a class="ui-state-default" href="#">20</a></td>
<a class="ui-state-default" href="#">20</a>
My vague guess is that the data-even click triggers the selection but it seems to be located a step above the class where I can find the number. This being said I am not sure it's the case.
I would really appreciate if you could help a newcomer like me!
Thanks!