I am hoping that I can select all the stock in the drop down menu, hit the "Search" button and hit "Export to CSV" button. However, I am stuck that I am not able to hit the Search button after choosing the option. Please advise. Thank you
from selenium import webdriver
from selenium.webdriver.support.ui import Select, WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from time import ctime
browser = webdriver.Chrome()
browser.get("https://www.hkex.com.hk/eng/sorc/options/statistics_hv_iv.aspx")
select = Select(WebDriverWait(browser, 10).until(EC.element_to_be_clickable((By.XPATH,
"//select[@id='underlying']"))))
browser.implicitly_wait(10)
optionsList = []
#iterate over the options, place attribute value in list
for option in select.options:
option.click()
optionsList.append(option.get_attribute("value"))
# below code is not able to work properly but this is only what I am hoping to work
elem = browser.find_element_by_link_text("Search")
elem.click()
elem1 = driver.find_element_by_link_text("Export to CSV")
elem1.click()
print(elem)
print(optionsList)
print(len(optionsList))
browser.quit