0

I'm trying to get selenium to press on the save button of the print pop up to save a pdf file. I can get selenium to press on the "print" button but once the pop up appears with the adress chrome://print/ nothing happens. Is there another way to do it?

This is the part's code so far:

        #download pdf
        download_button = wait.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="printpagetoolbar"]/tbody/tr/td[3]/table/tbody/tr/td/a')))
        download_button.click()

        # download file: Nothing happens, this doesn't work
        download = wait.until(EC.element_to_be_clickable(By.XPATH, '//*[@id="sidebar"]//print-preview-button-strip//div/cr-button[1]'))
        download.click()

This is the image of the pop up window: enter image description here

dazai
  • 766
  • 4
  • 25

1 Answers1

0

This answer here might help you: Selenium Webdriver: How to Download a PDF File with Python?

as well as:

Python Download PDF Embedded in a Page

Please leave any comments if you have further questions!

  • one of the solutions worked for me, but i get a window asking me to give a name to the file and i cant handle it – Carlost Jul 25 '22 at 05:44