【问题标题】:How to download excel file from a specific website by clicking a button and using Python?如何通过单击按钮并使用 Python 从特定网站下载 excel 文件?
【发布时间】:2021-06-11 22:19:09
【问题描述】:

有问题的链接是

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

目前我手动单击屏幕截图中显示的黄色标记按钮。如何改为使用 Python 将文件下载特定文件夹重命名

【问题讨论】:

    标签: python file automation download


    【解决方案1】:

    您可以使用 Selenium。设置驱动程序后;

    右键单击按钮,检查。复制完整的 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()
    

    【讨论】:

    • Ty,有没有其他方法可以在不使用 Selenium 的情况下下载文件以及可以下载到特定文件夹的方法?
    • 您也可以使用“请求”下载。要下载到某个文件夹,只需在下载前更改工作目录。我假设您只想下载一个文件:)
    • 泰。 :) 帮了我很多。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多