简体   繁体   English

如何通过单击按钮并使用 Python 从特定网站下载 excel 文件?

[英]How to download excel file from a specific website by clicking a button and using Python?

The link in question is有问题的链接是

https://www.de.vanguard/professionell/produktart/etf/aktien/9505/ftse-all-world-ucits-etf-usd-distributing#portfoliodaten https://www.de.vanguard/professionell/produktart/etf/aktien/9505/ftse-all-world-ucits-etf-usd-distributing#portfoliodaten

Currently I click manually the marked button in yellow shown in the screenshot.目前,我手动单击屏幕截图中显示的黄色标记按钮。 How can I instead use Python downloading the file into a specific folder and rename it?如何改用 Python将文件下载特定文件夹并重命名

在此处输入图像描述

You can use Selenium.您可以使用 Selenium。 After setting up your driver;设置驱动程序后;

Right click on the button, inspect.右键单击按钮,检查。 Copy full xpath.复制完整的 xpath。

driver.get("https://www.de.vanguard/professionell/produktart/etf/aktien/9505/ftse-all-world-ucits-etf-usd-distributing#portfoliodaten")

dlbutton = driver.find_element_by_xpath("/html/body/europe-core-root/europe-core-global-nav/div/europe-core-product-detail-page-component/section[4]/europe-core-market-allocation-container/europe-core-market-allocation/div/div/div[1]/div[2]/europe-core-download-button/button/span")

dlbutton.click()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM