I'm trying to read data from a website that contains multiple dropdown menus and tables using Selenium. Here's the link: "https://markets.ft.com/data/funds/tearsheet/historical?s=NL0006294175:EUR".
I need to change the date range, suppose that I want to see the prices of this stock from 1st January to 5th January, so I click on the 2 little calendars. Selecting and clicking on a certain date from the table on the left is ok, I manage to do it using xpaths and css selectors without problems.
However clicking on a date from the table on the right is really hard and I don't understand why. Python is always displaying errors like:
selenium.common.exceptions.ElementNotVisibleException: Message: element not interactable
Here's my code:
driver.get(r'https://markets.ft.com/data/etfs/tearsheet/historical?s=O9P:SES:USD')
driver.find_element_by_css_selector("body > div.o-grid-container.mod-container > div:nth-child(2) > section.mod-main-content > div:nth-child(1) > div > h2 > span").click()
driver.find_element_by_css_selector("body > div.o-grid-container.mod-container > div:nth-child(2) > section.mod-main-content > div:nth-child(1) > div > div > div.mod-ui-filter-overlay.clearfix.mod-filter-ui-historical-prices-overlay > div.mod-ui-overlay.mod-ui-filter-overlay__form > div > form > fieldset > span > div.mod-ui-date-picker.mod-filter-ui-historical-prices-overlay__date--from > div.mod-ui-date-picker__input-container > i").click()
driver.find_element_by_xpath('//*[@title="Next month"]').click()
driver.find_element_by_xpath("//*[@aria-label='1 Jan, %d']" %(y)).click() #The click on the table on the left works
driver.find_element_by_css_selector("body > div.o-grid-container.mod-container > div:nth-child(2) > section.mod-main-content > div:nth-child(1) > div > div > div.mod-ui-filter-overlay.clearfix.mod-filter-ui-historical-prices-overlay > div.mod-ui-overlay.mod-ui-filter-overlay__form > div > form > fieldset > span > div.mod-ui-date-picker.mod-filter-ui-historical-prices-overlay__date--to > div.mod-ui-date-picker__input-container > i").click()
time.sleep(2)
driver.find_element_by_xpath("//*[@aria-label='5 Jan, %d']" %(y)).click() #this does not work, the element is not interactable
I also tried to use ActionChains and WebDriverWait but nothing works. I suspect that the problem is that the two tables are really similar and selenium is trying to access the first table even after it is not visible anymore, but I really don't know how to fix that.
Do you know if there's a way to click on a date in the second table?
Thanks in advance.
