There is a link on a website that downloads a csv file. The link is in a table but the actual download link is hidden.
<div id="testjs">
<div test-example="">
<table test-example="">
<tr test-example="">
<th test-example="">Car</th>
<th test-example="">File</th>
</tr>
<tr test-example="">
<td test-example="">Ford</td>
<td test-example="">
<a test-example="" href="#">ford.csv</a>
</td>
</tr>
</table>
</div>
</div>
I'm trying automate file download by scraping the site using python/selenium.
from selenium import webdriver
driver = webdriver.PhantomJS()
driver.get("https://www.example.com")
driver.find_element_by_link_text('ford.csv')
When the last line above runs the script returns:
<selenium.webdriver.remote.webelement.WebElement (session="<example session string>", element="<example element string>")>
When I run the code below nothing happens:
driver.find_element_by_link_text('ford.csv').click()
How do I get the file to download?