![](/img/trans.png)
[英]How do i automatically download file using Python and Selenium without clicking Save button?
[英]How do I check if a URL will download a file using Selenium in Python?
我必须访问一个 URL 列表,但我不想打开那些将开始下载的 URL。
for url in url_list:
if (url will not start a download):
driver.get(url)
..................
else:
continue
有人对此有解决方案吗? 提前感谢您的回答
首先你可以得到 url 然后在 java 中使用 selenium 你可以在以下条件下:
(String)((JavascriptExecutor) driver).executeScript("return document.contentType;").equals("text/html");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.