Tried to download with Selenium and Python , the excel file by clicking the button on page but failed. Following is the class extracted from page:
<div class="tabPanel_func ts2_icon_map ts2_icon_excel" onclick="ExportExcel('tblTS2', tsData);"\>\</div\>`
I also want to download the file and then save to the specific drive location.
Following is my code :
url = "http://www.aastocks.com/tc/stocks/market/high-low-stocks.aspx?catg=1&period=3&t=1"
driver = webdriver.Chrome()
driver.get(url)
Code trials:
driver.find_element(By.XPATH, "//\[contains(@onclick, ExportExcel('tblTS2', tsData)')\]")`
or
driver.find_element(By.XPATH, "//\*\[@class= 'tabPanel_func ts2_icon_map ts2_icon_excel'\]")`
or
driver.find_element(By.CSS_SELECTOR, "//button\[contains(@onclick,'ExportExcel('tblTS2', tsData)')\]").click()`
All approaches have failed.