I am new to selenium and I am writing a scraper to download pdf files automatically from a given site. Below is my code
from selenium import webdriver
fp = webdriver.FirefoxProfile()
fp.set_preference("browser.download.folderList",2);
fp.set_preference("browser.download.manager.showWhenStarting",False)
fp.set_preference("browser.download.dir", "/home/jill/Downloads/Dinamalar")
fp.set_preference("browser.helperApps.neverAsk.saveToDisk", "application/pdf")
browser = webdriver.Firefox(firefox_profile=fp)
browser.get("http://ift.tt/1AqLiaP");
webobj = browser.find_element_by_id("download").click();
I followed the steps mentioned in Selenium documentation and in the this link
I am not sure why download dialog box is getting shown everytime.
Is there anyway to fix it else can there be a way to give "application/all" so that all the files can be downloaded(work-around)
Aucun commentaire:
Enregistrer un commentaire