1

I need your help, I am trying to automate the download of PDF files with selenium webdriver in python, this code when executed brings me the download links and prints them in console but I need them to be downloaded and saved locally in My PC.

I use ubuntu 18.04 as a development environment in python 3x. Thank you

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait as W
from selenium.webdriver.support import expected_conditions as E

URL = "https://www.diariooficial.interior.gob.cl/edicionelectronica/marcas_patentes.php?date=19-06-2020&edition=42685"



wait_time_out = 15
driver = webdriver.Chrome('./chromedriver')
driver.get(URL)
wait_variable = W(driver, wait_time_out)
links = wait_variable.until(E.visibility_of_all_elements_located((By.TAG_NAME, "a")))
print("Numero de links", len(links))
for link in links:
    print(link.text)

1 Answer 1

2

There are a lot of posts about that same issue.

In this(Selenium Webdriver in Python - files download directory change in Chrome preferences) one, there is a fix, where you change the default download location.

Also, have in mind that you may need to implement a routine to wait for downloads to finish(if you are downloading large files).

Hope it helps.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much for your answer, they are not such large files, but still thank you very much for your answer, I will review it. Thank you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.