I am trying to download a file from a website but am not able to interact with the download button.
The button is linked to the <a>
tag with a href=#
.
<div class="btn-wrapper">
<a class="btn btn-download" href="#" onclick="creditingRates.download();" style="display: block;">Download CSV</a>
</div>
I have tried the following but non seemed to work.
WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//a[@href='#')]"))).click()
WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@class='btn btn-download']/a[text()='Download CSV']))).click()
a
element who has class="btn btn-download"
, not a parent div
element.WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//a[@class='btn btn-download'][text()='Download CSV']"))).click()
Or maybe
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//a[@class='btn btn-download'][contains(,text(),'Download CSV')]"))).click()