I want to examine a button that leads to downloading a file. the HTML contains:

<a class="calibre-push-button " href="/calibre/get/EPUB/123/calibre" role="button" title="Download this file" download="a.txt"><svg style="fill: currentColor; height: 2ex; width: 2ex; vertical-align: text-top"><use xlink:href="#icon-cloud-download"></use></svg><span>&nbsp;Download</span></a>

I want to write a python code to download the file (click on the button) and save it. I started working with Selenium, but hit the wall. This is what I've done:

from selenium import webdriver
gotit = driver.find_element_by_xpath("//a.calibre-push-button [contains(text(),'')]")

I want the gotit element to store the button optionally and allow gotit.click().

Any ideas?



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.