Click here to Skip to main content
15,889,403 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I used profile.SetPreference for changing the download directory of the FF. I debugged it and saw that it is rendering properly in code but the file is not properly saved in that directory. Thanks in advance
Posted

1 solution

profile.SetPreference
is explicitly used for profile setting modifier.It would have been helpful to find the issue with you code if you provide the Webdriver,FF driver and browser versions.

Though I have used the below furnished code in my code and it has been executed properly.

Selenium version: 3.3.1
OS:Win 7 64b
Browser: Firefox
Browser version:53.0.3


// Create a firefoxprofile for firefox specific settings
FirefoxProfile profile = new FirefoxProfile();

// Set the downloads folder
profile.setPreference("browser.download.dir", path/to/folder);

// Download files to the downloads folder
profile.setPreference("browser.download.folderList", 2);

// Don't show downloads window when download starts
profile.setPreference("browser.download.manager.showWhenStarting", False);

// Prevent file download dialog to be shown for certain MIME-types
profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/pdf");
 
Share this answer
 
Comments
OriginalGriff 12-Jun-17 4:39am    
This question is five years old! The chances are that the author doesn't need a solution any more.
Please be careful what you answer: posting answers to very old questions can make people assume you are a "rep point farmer" and we count that as abuse - and abusive members get banned. I don't think you intended that with this, so I'll not report you, but there are a lot more trigger happy members here, and if you make a habit of posting solutions to ancient questions, you will get caught, and you will get banned.

So try to stick to recent questions if you can! :laugh:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900