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)