Issue 7174 in selenium: Firefox downloading file without window

40 views
Skip to first unread message

sele...@googlecode.com

unread,
Apr 3, 2014, 1:40:10 PM4/3/14
to selenium-develope...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium Status-Untriaged

New issue 7174 by samuel...@gmail.com: Firefox downloading file without
window
http://code.google.com/p/selenium/issues/detail?id=7174

What steps will reproduce the problem?
1. define the parameters of download firefox not open window
2. trying to download an image
3. try to download a txt

What is the expected output? What do you see instead?
in step 2 the image is downloaded without opening any window
in step 3 firefox asks to save the file

Selenium version: 2.41
OS:Win 7 64b
Browser: Firefox
Browser version: 28


following this tutorial:
http://elementalselenium.com/tips/2-download-a-file

Implemented in Java with selenium version 2.41. Worked perfectly with the
image, but with txt (and xml from another site) does not work, always opens
the download window.


The code:
//---------------------------------------------
FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.setAcceptUntrustedCertificates(true);
firefoxProfile.setPreference("browser.download.folderList",2);//browser dir
firefoxProfile.setPreference("browser.download.dir","C:\\temp\\");
firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk","application/xml,text/plain,text/xml,image/jpeg");

driver = new FirefoxDriver(firefoxProfile);

driver.get("http://the-internet.herokuapp.com/download");

new WebDriverWait(driver,
10).until(ExpectedConditions.presenceOfElementLocated(By.className("example")));

driver.get("http://the-internet.herokuapp.com/download/boletos.txt");
driver.get("http://the-internet.herokuapp.com/download/avatar.jpg");


Thread.sleep(10000);
driver.quit();
//---------------------------------------------


--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

sele...@googlecode.com

unread,
Apr 3, 2014, 1:41:52 PM4/3/14
to selenium-develope...@googlegroups.com

Comment #1 on issue 7174 by samuel...@gmail.com: Firefox downloading file
without window
http://code.google.com/p/selenium/issues/detail?id=7174

personal apology, I forgot to say: the above example developed in JAVA JDK
1.6.0_45

sele...@googlecode.com

unread,
Apr 8, 2014, 9:01:11 AM4/8/14
to selenium-develope...@googlegroups.com
Updates:
Status: WontFix
Labels: -Status-Untriaged

Comment #2 on issue 7174 by barancev: Firefox downloading file without
window
http://code.google.com/p/selenium/issues/detail?id=7174

Selenium is not intended to deal with anything other than HTML documents.

sele...@googlecode.com

unread,
Apr 8, 2014, 11:24:00 AM4/8/14
to selenium-develope...@googlegroups.com

Comment #3 on issue 7174 by samuel...@gmail.com: Firefox downloading file
without window
http://code.google.com/p/selenium/issues/detail?id=7174

Problem solved add:
firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk","application/octet-stream");

tks

sele...@googlecode.com

unread,
Dec 2, 2014, 3:04:07 PM12/2/14
to selenium-develope...@googlegroups.com

Comment #4 on issue 7174 by cbaqu...@temperies.com: Firefox downloading
file without window
https://code.google.com/p/selenium/issues/detail?id=7174

Hi,
I'm having a similar issue. I know Selenium is not supposed to handle the
downloaded file, but I need to download it anyway.

I'm trying to download a csv and a pdf file. Only tried for csv so far and
it fails. I looked for the MIME type as it says here:
http://watirmelon.com/2011/09/07/determining-file-mime-types-to-autosave-using-firefox-watir-webdriver/

My code is the following:

--------------
String downloadDir = System.getProperty("user.home") + "\\Downloads";

FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.setAcceptUntrustedCertificates(true);
firefoxProfile.setPreference("browser.download.folderList",2);
firefoxProfile.setPreference("browser.download.dir",downloadDir);

firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk","application/xml,text/plain,text/xml,image/jpeg,text/csv");

WebDriver driver = new FirefoxDriver(firefoxProfile);

//this works ok
driver.get("http://172.16.1.4:9090/img/caro/hello.html");
new WebDriverWait(driver,
10).until(ExpectedConditions.presenceOfElementLocated(By.id("hello")));

//this downloads the jpg file without confirmation dialog
driver.get("http://the-internet.herokuapp.com/download/avatar.jpg");
Thread.sleep(3000);

//this launches the confirmation dialog
driver.get("http://172.16.1.4:9090/img/caro/test.csv");
Thread.sleep(3000);

driver.quit();

--------------

Thanks,
Carolina

sele...@googlecode.com

unread,
Feb 11, 2015, 8:22:08 AM2/11/15
to selenium-develope...@googlegroups.com

Comment #5 on issue 7174 by im.vikra...@gmail.com: Firefox downloading file
without window
https://code.google.com/p/selenium/issues/detail?id=7174

Even Im facing the similar issue mentioned.When I click on download
provided on my website.It opens a dialog box.Please if anyone knows the fix
for this.Let me know.
Below are the prefernces I have used.
ProfilesIni myProfile=new ProfilesIni();

FirefoxProfile profile=myProfile.getProfile("FirefoxVikram");
profile.setAcceptUntrustedCertificates(true);
profile.setPreference("browser.download.folderList", 2);
profile.setPreference("browser.download.manager.showWhenStarting", false);

profile.setPreference("browser.download.dir", "C:\\Users\\L069570\\Vikram\\Xpath");
profile.setPreference("browser.helperApps.neverAsk.openFile","text/csv,
application/pdf,application/octet-stream");
profile.setPreference("browser.helperApps.alwaysAsk.force", false);
profile.setPreference("browser.download.manager.alertOnEXEOpen", false);
profile.setPreference("browser.download.manager.focusWhenStarting",
false);
profile.setPreference("browser.download.manager.useWindow", false);
profile.setPreference("browser.download.manager.showAlertOnComplete",
false);
profile.setPreference("browser.download.manager.closeWhenDone", true);
driver =new FirefoxDriver(profile);

sele...@googlecode.com

unread,
Feb 11, 2015, 8:23:58 AM2/11/15
to selenium-develope...@googlegroups.com

Comment #6 on issue 7174 by im.vikra...@gmail.com: Firefox downloading file
without window
https://code.google.com/p/selenium/issues/detail?id=7174

ven Im facing the similar issue mentioned.When I click on download provided
on my website.It opens a dialog box.Please if anyone knows the fix for
this.Let me know.
Below are the prefernces I have used.
ProfilesIni myProfile=new ProfilesIni();

FirefoxProfile profile=myProfile.getProfile("FirefoxVikram");
profile.setAcceptUntrustedCertificates(true);
profile.setPreference("browser.download.folderList", 2);
profile.setPreference("browser.download.manager.showWhenStarting", false);

profile.setPreference("browser.download.dir", "F:\\Users\\xyz\\sel\\dwnlds");

sele...@googlecode.com

unread,
Apr 24, 2015, 3:28:49 AM4/24/15
to selenium-develope...@googlegroups.com

Comment #7 on issue 7174 by sivachit...@gmail.com: Firefox downloading file
without window
https://code.google.com/p/selenium/issues/detail?id=7174

Is it fixed?
Reply all
Reply to author
Forward
0 new messages