我正在尝试使用请求库从这个website下载一个文件,但是我不知道如何使用一些日期参数激活一个按钮来下载"XLS“文件。
我想不使用浏览器下载此文件。
当检查按钮时,我得到以下代码:
<button class="btn btn-primary" id="btnGerarPrecoHorarioXls" onclick="gerarPrecoHorarioXls();return false;">Gerar Arquivo <i aria-hidden="true" class="fa fa-file-excel-o fa-2"> </i></button>当激活该按钮时,似乎在网络选项卡上启动了js。
但我不知道如何插入参数以使其返回文件
发布于 2021-08-12 05:49:13
您可以使用Selenium单击网页上的项目。例如:
from selenium import webdriver
import time
options = webdriver.ChromeOptions()
button = driver.find_elements_by_xpath("Right click on the item, choose inspect, then right click, copy xpath and put it in here.")[0]
button.click()https://stackoverflow.com/questions/68751337
复制相似问题