1

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
driver=webdriver.Chrome(executable_path='chromedriver')#,chrome_options=options)
driver.get('http://website.address.com')
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?

2

0

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.