How to use Selenium for download file from a list of URLs?
Hi,
You can effortlessly download files without Selenium by using the requests library. Below is an example code snippet:
import requests
for web in down_link: fileName = YOUR_DOWNLOAD_PATH + web.split(“=”)[1].split(“&”)[0] + “.pdf”
r = requests.get(web, stream=True)
with open(fileName, 'wb') as f:
for chunk in r.iter_content():
f.write(chunk)
This code iterates through a list of download links, retrieves each file, and saves it to a specified path using the requests library.