!!

Welcome to Selenium Webdriver Forum

As a web user you can read and search through forum content. Once you have registered and signed you can post topics, post replies, set up watch lists, modify forum settings, and use private messaging.

Author Topic: Firefox Profile Configuration - Testing download files  (Read 3928 times)

Van

  • Web User
Firefox Profile Configuration - Testing download files
« on: March 28, 2012, 08:13:09 PM »
Hi Everyone,
 I'm trying to test the behavior of a link that allows to download a
 file. I'd like to configure the firefox profile to always download the
 file in an specific directory.
 To set the download directory, I have tried:
 
FirefoxProfile profile = new FirefoxProfile();
 profile.setPreference("browser.download.lastDir",System.getProperty
 ("user.home"));
 WebDriver driver = new FirefoxDriver(profile);
 
But it doesn't seem to work. When the test is running on debug mode,
 and it opens the firefox's window, I review the options configurations
 and the download directory is the same as in my normally firefox
 profile (it's on Desktop instead of being my user home directory).
 
I would really appreciate some help about how can I set the download
 directory, and how can I configure the profile to always allow to
 download a file without a previous question (open or save).
 
Thanks!
 
Van

Daniel Wagner-Hall

  • Web User
Re: Firefox Profile Configuration - Testing download files
« Reply #1 on: March 28, 2012, 08:13:25 PM »
- Show quoted text -

Try also setting browser.download.useDownloadDir to false

Will Roden

  • Web User
Re: Firefox Profile Configuration - Testing download files
« Reply #2 on: March 28, 2012, 08:13:35 PM »
I had a similar problem.  I'll post the solution here for the next
 person who needs it.  What I needed was to automatically download pdfs
 to a given folder to inspect later.  The webserver I'm testing uses
 the mime type "application/pdf" for pdfs, so I used this code to
 modify the firefox profile:
                 FirefoxProfile profile = new FirefoxProfile();
                 profile.setPreference("browser.download.dir", "c:\\temp\
 \webdriverDownloads");
                 profile.setPreference("browser.download.folderList", 2);
                 profile.setPreference("browser.helperApps.neverAsk.saveToDisk",
 "application/pdf");
                 WebDriver driver = new FirefoxDriver(profile);
 
On Oct 19, 1:39 pm, Van <vanunterm...@gmail.com> wrote:
 

- Show quoted text -

Selenium Webdriver

Re: Firefox Profile Configuration - Testing download files
« Reply #2 on: March 28, 2012, 08:13:35 PM »

 

Related Topics

  Subject / Started by Replies Last post
4 Replies
1546 Views
Last post February 21, 2012, 08:48:05 PM
by punit jain
1 Replies
617 Views
Last post February 22, 2012, 07:01:29 PM
by Paollo Kuccinni
2 Replies
1744 Views
Last post March 28, 2012, 08:02:50 PM
by Michael Yin
2 Replies
1895 Views
Last post March 29, 2012, 02:15:29 PM
by poobathy r
1 Replies
968 Views
Last post April 01, 2012, 02:28:35 PM
by poobathy r
20 Replies
3228 Views
Last post April 01, 2012, 03:00:07 PM
by payal
6 Replies
2100 Views
Last post April 12, 2012, 04:53:44 PM
by Elhadji Amadou WADE