In Webdriver Firefox browser Default download location is set by default

1,928 views
Skip to first unread message

saorabh singh

unread,
Jun 21, 2012, 6:58:39 AM6/21/12
to seleniu...@googlegroups.com
Hi,

In Webdriver Firefox browser , Downloaded file will be saved to a fixed location,
So is there any way to invoke browser with Download option as :Always ask me where to save files,
Or it should pic setting saved in default Firefox browser.

ACTUAL:
---------------
 Downloaded file will be saved to a fixed location , because , in Toll-->option-->Download Settings is set to :Save files to (LOCATION FOLDER)

REQUIRED:
---------------------------
invoke browser with Download option as :Always ask me where to save files,
Or it should pic setting saved in default Firefox browser.

I am using Webdriver Ver: 2.21 with java

Please help me out.

Regards,
Saorabh Singh

Peter Gale

unread,
Jun 21, 2012, 7:04:54 AM6/21/12
to seleniu...@googlegroups.com
Soarabh

If you were to configure to ask you for a location to save the fiel to, then you would have an operating system level dialog that you could not control easily through webdriver.

So a better approach woudl be to set the firefox preference for the fixed file download location to the one you wnat just before you donwload the file.

You shousl be able to see the preference name through about:config in Firefox.



Date: Thu, 21 Jun 2012 03:58:39 -0700
From: kun...@gmail.com
To: seleniu...@googlegroups.com
Subject: [selenium-users] In Webdriver Firefox browser Default download location is set by default
--
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/-/uyE3oStGmqMJ.
For more options, visit https://groups.google.com/groups/opt_out.

saorabh singh

unread,
Jun 21, 2012, 7:53:31 AM6/21/12
to seleniu...@googlegroups.com
Hi all,

Well Actually , My requirement is :
I need to download some files(reports) at the end of each scenario, So the name of files getting downloaded is in some pre-described format, i need to rename before saving.(Renaming is done using Sikuli tool)
So that's why i need that option to save file in Specific location.
I have gone trough some of the questions posted, but none has helped me till now to solve this problem, please help me out.

Regards,
Saorabh Singh

Krishnan Mahadevan

unread,
Jun 21, 2012, 8:03:13 AM6/21/12
to seleniu...@googlegroups.com
You should instead look at implementations such as this :





Thanks & Regards
Krishnan Mahadevan

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

Peter Gale

unread,
Jun 21, 2012, 8:05:08 AM6/21/12
to seleniu...@googlegroups.com
Renaming a file using Sikuli sounds an exceedingly round about way of doing things.

Why not set the download location to an empty folder you've created and then rename and move each file in turn to wherever you want to keep them - you can do that with a few simple lines of java.


Date: Thu, 21 Jun 2012 17:23:31 +0530
Subject: Re: [selenium-users] In Webdriver Firefox browser Default download location is set by default
From: kun...@gmail.com
To: seleniu...@googlegroups.com

saorabh singh

unread,
Jun 21, 2012, 8:49:08 AM6/21/12
to seleniu...@googlegroups.com
Hello peter,
Thanks for concern,
Actually downloaded files have to renamed as per the user name for each test case(user name is distinct for each scenario) & there are Some 150 test cases, So if I don't rename them while saving/downloading then it would be very difficult correct file & to rename them.
that's why I am using Sikuli to attain this.
Please let me know if there is a better way to achieve this goal.

Regards,
Saorabh Singh

saorabh singh

unread,
Jun 21, 2012, 9:00:46 AM6/21/12
to seleniu...@googlegroups.com
Hi  Krishnan,

I went trough the link provided by You, but it does not solve my problem.
This has info to change Download location, but i want to save File before renaming them, So for that i want that when browser is launched "save file in Specific location"feature should be enabled which will allow me to rename the file before saving.

Please help me out.

Regards,
Saorabh Singh 

Krishnan Mahadevan

unread,
Jun 21, 2012, 9:03:23 AM6/21/12
to seleniu...@googlegroups.com
What is stopping you from first downloading to a common place for e.g., temp directory, and then renaming the file to whatever you want it and moving it to where ever you want ?
Why would that not work for you ?

Thanks & Regards
Krishnan Mahadevan

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


Peter Gale

unread,
Jun 21, 2012, 9:14:28 AM6/21/12
to seleniu...@googlegroups.com
The way I suggested seems better. There would only be one file in your temporary folder at time of doenloading individual files in turn so it could be easily identified and your java code would obviously know the username at this point in time, so you can esily rename it and move it to wherever you like.

Krishnan has also pointed you to another solution that may prove even easier to use - I presume it may well let you specify the target folder and filename without having to worry about what the default folder location and filenames are.


Date: Thu, 21 Jun 2012 18:19:08 +0530

Mark Collin

unread,
Jun 26, 2012, 7:08:13 AM6/26/12
to seleniu...@googlegroups.com

Tweak line 113 to set a specific filename rather than extracting it from the download URL.

saorabh singh

unread,
May 9, 2013, 5:37:14 AM5/9/13
to seleniu...@googlegroups.com
Hi,
Sorry for late reply u can rename & save a a file in different location using java function & delete the original file from downloaded location ( in order to eradicate duplicate file name problem) 


On Fri, May 3, 2013 at 1:30 PM, Sumita <sim....@gmail.com> wrote:

Hi Saorabh,

I have exactly same set of requirements as mentioned by you. Did you find any solution for this ?

Please help.

Regards
Sumita
--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/fms4I_fvutQ/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to selenium-user...@googlegroups.com.

To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/-scRIRBejDYJ.

Mark Collin

unread,
May 9, 2013, 9:34:47 AM5/9/13
to seleniu...@googlegroups.com
have a read of this:

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

It questions why you are downloading files and gives you a cross platform solution to download files to whatever location you want, and set the name of them
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.
Reply all
Reply to author
Forward
0 new messages