I am unable to download a CSV file using Selenium-Webdriver in a Chrome Browser window (Version 73.0.3683.86 (Official Build) (64-bit)) that opens when doing automated tests. I am using Selenium version: 3.4
Here is the HTML:
<h4>
<a href="/Hardware/ExportCsv?hardId=USB" download="Drives.csv" id="excel-btn">
<img src="../../Content/Images/excel.svg">
Export csv file.
</a>
</h4>
Neither click()
nor using the Actions
class work. If I click the link with my mouse, the file is downloaded.
Browser.driver.findElement(By.id("excel-btn")).click();
action.moveToElement(Browser.driver.findElement(By.id("excel-btn"))).click().perform();
I expect the file to be downloaded.
Instead, however, the download link text is just being highlighted.
Important to note: in contrast, I can find other elements, assign them to a WebElement
and execute Selenium actions on those elements successfully. It is just the download that is eluding me.