Discussion:
Downloading a File
Samuel Facchinello
11 years ago
Permalink
Hi, I'm Samuel of Brazil.
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.

Any tips?

Thank you.



CODE:

FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.
setAcceptUntrustedCertificates(true);
firefoxProfile.setPreference("browser.download.folderList",2);//browser
dir
firefoxProfile.setPreference("browser.download.dir",tempDir);
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/dummy.txt
");
driver.get("
Failed to load image: http://the-internet.herokuapp.com/download/avatar.jpg");
driver.quit();
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To post to this group, send email to selenium-users-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/be55e2db-065c-469f-a7dc-6d27c714c86c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Mark Collin
11 years ago
Permalink
I'll link you to my various things about file downloads in Selenium:

https://skillsmatter.com/skillscasts/5068-what-did-you-just-download
http://ardesco.lazerycode.com/index.php/2012/07/how-to-download-files-with-selenium-and-why-you-shouldnt
https://github.com/Ardesco/What-Did-You-Download
http://www.slideshare.net/Ardesco/what-did-you-just-download
...
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To post to this group, send email to selenium-users-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/4e169140-7f4a-4d51-be60-a126f68d22a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Ashok kumar
11 years ago
Permalink
Look for ''Handling windows dialogs'' section in below link.

http://automationtestingutilities.blogspot.in/

-Ashok
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To post to this group, send email to selenium-users-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/69884c82-4300-47fb-a632-df1ff7d21794%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Samuel Facchinello
11 years ago
Permalink
Hey guys, problem solved, it was sufficient to add the correct mimetype
'application/octet-stream' in "browser.helperApps.neverAsk.saveToDisk" and
everything worked perfectly.

Thanks for the tips.


Em terça-feira, 1 de abril de 2014 11h56min25s UTC-3, Samuel Facchinello
...
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To post to this group, send email to selenium-users-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/b02d1ae0-ca93-428b-946c-4601dfd8062d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...