Python Selenium Select: "Element <option> could not be scrolled into view" Python Selenium Select: "Element <option> could not be scrolled into view" selenium selenium

Python Selenium Select: "Element <option> could not be scrolled into view"


Here is a code block to solve your issue, I reorganized some of your code as well. Please make sure to import this from selenium.webdriver.support.ui import Select so you can use the Select in the code block:

driver.get('https://www.bungol.ca/')wait = WebDriverWait(driver, 10)wait.until(EC.element_to_be_clickable((By.XPATH, './/button[@type="submit" and text()="Search"]'))).click()wait.until(EC.element_to_be_clickable((By.ID, 'activeListings'))).click()wait.until(EC.element_to_be_clickable((By.ID, 'useDateRange'))).click()# I found that I had to click the start date every time I wanted to interact with# anything related to the date selection div/tablewait.until(EC.element_to_be_clickable((By.XPATH, './/input[@id="dateRangeStart" and @name="soldDateStart"]')))driver.find_element_by_xpath('.//input[@id="dateRangeStart" and @name="soldDateStart"]').click()yearSelect = Select(driver.find_element_by_xpath('.//select[@class="pika-select pika-select-year"]'))yearSelect.select_by_visible_text('2015')wait.until(EC.element_to_be_clickable((By.XPATH, './/input[@id="dateRangeStart" and @name="soldDateStart"]')))driver.find_element_by_xpath('.//input[@id="dateRangeStart" and @name="soldDateStart"]').click()monthSelect = Select(driver.find_element_by_xpath('.//select[@class="pika-select pika-select-month"]'))monthSelect.select_by_visible_text('January')wait.until(EC.element_to_be_clickable((By.XPATH, './/input[@id="dateRangeStart" and @name="soldDateStart"]')))driver.find_element_by_xpath('.//input[@id="dateRangeStart" and @name="soldDateStart"]').click()driver.find_element_by_xpath('.//td[@data-day="1"]').click()

After running that, you should have the date selected January 1, 2015 for the first part of the range. You can use the same techniques to select the second part of the range if needed.

For more information on how to use the Select please visit THIS.