1

I have used below code to get the pdf file in desired path, however not able to save the file? Is there any specific function in selenium to download the PDF file from pdf link:

from selenium import webdriver

options = webdriver.ChromeOptions()
prefs = {"download.default_directory" : r"C:\Users\adarshb061\Desktop"}
options.add_experimental_option("prefs", prefs)

chrome_path = r"C:/chromedriver.exe"
driver = webdriver.Chrome(chrome_path,chrome_options=options)
browser = driver.get("https://rbi.org.in/")
driver.maximize_window()

driver.find_element_by_xpath("""//*[@id="FEMA"]/a""").click()
driver.find_element_by_xpath("""//*[@id="FEMANotifications"]""").click()


rows = driver.find_elements_by_xpath("//table[@class='tablebg']//tr//td/a[contains(@href,'http://')]")
for row in rows:
    pdf = row.get_attribute('href')
    driver.get(pdf)
adarsh2109
  • 109
  • 1
  • 11
  • 1
    Possible duplicate of [download and save multiple csv files using selenium and python from popup](https://stackoverflow.com/questions/45097302/download-and-save-multiple-csv-files-using-selenium-and-python-from-popup) – undetected Selenium Nov 20 '17 at 07:14
  • This is on firefox. How do I get the properties of chrome? I am building automation on chrome browser. – adarsh2109 Nov 20 '17 at 07:48
  • Possible duplicate of [Chromedriver, Selenium - Automate downloads](https://stackoverflow.com/questions/26894071/chromedriver-selenium-automate-downloads) – Nemo May 07 '18 at 09:54

0 Answers0