Can anyone help with file download dialog??

3,016 views
Skip to first unread message

sanju

unread,
Jul 24, 2012, 3:01:50 AM7/24/12
to seleniu...@googlegroups.com
Hi all!
I have problem with file download dialog. I don’t know how to insert path where to save and click "Save" button.
I'm writing my test on java and use Selenium webdriver

Peter Gale

unread,
Jul 24, 2012, 3:26:52 AM7/24/12
to Selenium Users
That's not a browser dialog, so cannot be controlled with Selenium.

There are lots of threads on thsi forum about downloading files with Selenium, so just search for those to get full details of how to do it with Selenium.


Date: Tue, 24 Jul 2012 00:01:50 -0700
From: sanjee...@gmail.com
To: seleniu...@googlegroups.com
Subject: [selenium-users] Can anyone help with file download dialog??


Hi all!
I have problem with file download dialog. I don’t know how to insert path where to save and click "Save" button.
I'm writing my test on java and use Selenium webdriver

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/Yn_XphVYJYoJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Mark Collin

unread,
Jul 24, 2012, 4:08:25 AM7/24/12
to seleniu...@googlegroups.com

You can’t the file dialogue is an OS level dialogue.

 

Have a search through the group for previous file download threads this has been discussed many times, also have a look at this:

 

https://github.com/Ardesco/Powder-Monkey/blob/master/src/main/java/com/lazerycode/selenium/filedownloader/FileDownloader.java

 

Short Link

 

The above is the newer and slightly improved version of my file download class (I have an even newer one that I haven’t quite finished yet that is on the way).

 

From: seleniu...@googlegroups.com [mailto:seleniu...@googlegroups.com] On Behalf Of sanju
Sent: 24 July 2012 08:02
To: seleniu...@googlegroups.com
Subject: [selenium-users] Can anyone help with file download dialog??

 

Hi all!

I have problem with file download dialog. I don’t know how to insert path where to save and click "Save" button.
I'm writing my test on java and use Selenium webdriver

--

Mark Collin

unread,
Jul 24, 2012, 5:20:04 AM7/24/12
to seleniu...@googlegroups.com

File downloader function has been improved again, I will probably merge it with the status checker since the functionality is now about 80% identical.  I have a blog post to write first though J

sanju

unread,
Jul 26, 2012, 2:34:22 AM7/26/12
to seleniu...@googlegroups.com
Thanks All, I got the soluntion.

Mark Collin

unread,
Jul 26, 2012, 3:50:37 AM7/26/12
to seleniu...@googlegroups.com

--

You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/MlDk9nV_hMIJ.

Krishnan Mahadevan

unread,
Jul 26, 2012, 3:55:43 AM7/26/12
to seleniu...@googlegroups.com
Mark,
Finally a post on the famous download files :) 


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

Mark Collin

unread,
Jul 26, 2012, 4:28:58 AM7/26/12
to seleniu...@googlegroups.com

I’ve got sufficiently frustrated with repeating the same thing again and again so decided to write something I can just link to that says everything already J

Krishnan Mahadevan

unread,
Jul 26, 2012, 4:31:51 AM7/26/12
to seleniu...@googlegroups.com
:) I can completely understand. In-fact its gone to such an extent that the moment someone states "download files" the first thing that comes to my mind is your replies and your attempts on educating people the rights and wrongs of dealing with download files :)

Am glad you found sometime to consolidate everything that you had to say about download files as a blog. Its easier to just tell people to go take a look at your post :)


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



Mark Collin

unread,
May 15, 2013, 9:50:13 AM5/15/13
to seleniu...@googlegroups.com
Read all of this

http://ardesco.lazerycode.com/index.php/2012/07/how-to-download-files-with-selenium-and-why-you-shouldnt/


On 15/05/2013 11:26, shivanand havannavar wrote:
Hello Sir,
���������������� I am Shivanand H, I am trying to download a file using selenium webdriver
considering this url---
�
one popup will come in that save and cancel are two options, please help me out regarding this.

�

�

�

On Tuesday, 24 July 2012 12:31:50 UTC+5:30, sanju wrote:
Hi all!
I have problem with file download dialog.�I don�t know how to insert path where to save and click "Save" button.
I'm writing my test on java and use Selenium webdriver
--
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-user...@googlegroups.com.

To post to this group, send email to seleniu...@googlegroups.com.
�
�

belmansarada prasad

unread,
Jul 8, 2013, 7:25:37 AM7/8/13
to seleniu...@googlegroups.com
Try this

String sourcelocation=downloadbutton.getAttribute("href");
    String wgetcommand="cmd /c wget -P c: " +sourcelocation;
    //String wgetcommand="cmd /c wget -P D: http://rd.software.yahoo.com/msgr/11/msgr11us.exe" ;
    try
 {
         Runtime rt = Runtime.getRuntime();
         Process exec=rt.exec(wgetcommand);
        Process exec=Runtime.getRuntime().exec(wgetcommand);
        int exeval=exec.waitFor();
}
catch(IOException ex)
   {
       /System.out.println("Exception held" );
   /}
        driver.quit();

    }
    }
On Tuesday, July 24, 2012 12:31:50 PM UTC+5:30, sanju wrote:

chinni

unread,
Sep 24, 2013, 8:53:09 AM9/24/13
to seleniu...@googlegroups.com

If $CmdLine[0] = 2 Then
       WinWait($CmdLine[1] & " " & $CmdLine[2],"", 10)
    $retVal = WinExists($CmdLine[1] & " " & $CmdLine[2])
    If $retVal <> 0 Then
       WinActivate($CmdLine[1] & " " & $CmdLine[2])
     ;Send("{TAB 3}") for saving and opening a file
     Send("{DOWN}")
     Send("{ENTER}")
    EndIf
 EndIf
 Exit

Write this script in Auto IT, and generate the EXE file. Place this EXE file in your program and run it.

Radha Krishna

unread,
Sep 25, 2013, 6:01:45 AM9/25/13
to seleniu...@googlegroups.com
Hi

public void DownloadAFileUsingProfile()
        {
            //Step1: Create a profile or get existing profile
            //FirefoxProfile ffprofile = new FirefoxProfile();

            //Step2: Set preference.
            // 0 = desktop, 1 = default download folder , 2 = user defined location.                       
            ffprofile.setEnableNativeEvents(true);
            ffprofile.setPreference("browser.download.dir", "C:\\Users\\Adeptpros\\Downloads");           
            ffprofile.setPreference("browser.download.folderList", 2);
           
            /* Step3: NeverAsk - we are telling selenium to never present the download window dialog to the user to click ok or cancel
               ie.simply download the file to the folder mentioned above.
               mention the type of files to be download as comma seperated values.
             */
            ffprofile.setPreference("plugin.disable_full_page_plugin_for_types", "application/zip,application/msword,application/pdf,text/csv,aplication/csv,application/octet-stream");
            ffprofile.setPreference("browser.helperApps.neverAsk.saveToDisk", "text/x-patch,application/x-jar,application/vnd.android.package-archive,application/zip,application/msword,application/pdf,text/comma-separated-values, text/csv, application/csv, application/excel, application/vnd.ms-excel, application/vnd.msexcel, text/anytext,application/octet-stream");
           
           
            WebDriver driver = new FirefoxDriver(ffprofile);

            driver.get("http://encodable.com/filechucker/");           
            driver.findElement(By.xpath("//div[@class = 'product_action_buttons']/a[2]/img")).click();
           
        }

Any doubts get back to me.


On Tuesday, 24 July 2012 12:31:50 UTC+5:30, sanju wrote:

Automation Testing Utilities

unread,
Oct 10, 2013, 1:41:52 PM10/10/13
to seleniu...@googlegroups.com
Hi,

Handling windows elements using selenium was one area which everybody pointed at. we are happy to announce that we can successfully handle the following items using Selenium Java.
  • Downloading Files
  • Uploading Files
  • Windows Authentications
We are developing an Open source project for the same. The first release would be available very soon.
Further Details can be found at: http://automationtestingutilities.blogspot.in/


Regards
Automation Tester

Automation Testing Utilities

unread,
Oct 15, 2013, 11:49:34 AM10/15/13
to seleniu...@googlegroups.com
Hi,

The project (Handling Windows Dialogs) is now available for Download.

Regards
Automation Tester
Reply all
Reply to author
Forward
0 new messages