Download multiple files?

1,016 views
Skip to first unread message

Kevin Burton

unread,
Jan 12, 2015, 12:39:03 PM1/12/15
to seleniu...@googlegroups.com
I am trying to download one file at a time but with the WebDriver (with C#) I am guessing that since there are multiple files queued up the browser considers multiple files to be downloaded. If there are multiple files I get the attached notice in the browser. So I have two questions:
1) I do I automatically select 'Allow'. I have Googled and found one propsed solution is to find the element via XPath and then click it. It sounds easy enough but I am not sure how to get the XPath for the element since it is part of the browser and not part of the page.
2) How do I detect if I only download one file and the prompt doesn't appear?
Thank you.
Kevin


Mark Collin

unread,
Jan 13, 2015, 1:07:51 AM1/13/15
to seleniu...@googlegroups.com
That is an OS level dialogue box, you will not be able to click on the button using selenium.  Here’s a few links to things I’ve talked/written about file down;pads in the past, hopefully they will be of use:


--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/2daeac30-0773-4067-8847-7a82722d289a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kevin Burton

unread,
Jan 13, 2015, 12:38:21 PM1/13/15
to seleniu...@googlegroups.com
The video was helpful but I have two questions:
1) The preferences that you set were not really clear in the video. It may have something to do with the video driver that I am using. Do you have a text copy of the preferences that you set.
2) It seems that this is specific to FireFox. Are the preferences the same for Chrome?

Thanks again.

Kevin

Mark Collin

unread,
Jan 14, 2015, 3:41:26 AM1/14/15
to seleniu...@googlegroups.com
The point is that You shouldn't set preferences to just download stuff because you don't actually know what you are downloading.  

The code from the presentation is available here (It is Java but I'm sure you can easily get the gist of it):


If you are determined to just download anything and not check what has been downloaded the relevant part for Firefox is in:


You would need to do this for each driver you support, it is a per browser configuration.

The question still remains, what are you trying to test?  That a browser can download files?  What are you going to do if it can't?  Can you fix the browser and force your users to use your modified version of the browser?

Kevin Burton

unread,
Jan 14, 2015, 12:18:13 PM1/14/15
to seleniu...@googlegroups.com
Thank you for your help.

I know what I am downloading. I just don't want to be prompted when I try to download more than one file. I am guessing this preference in FireFox stops the multiple download prompt:

firefoxProfile.setPreference("browser.helperApps.alwaysAsk.force", false);

I don't see an equivalent setting for Chrome. It doesn't exist?

PeterJeffreyGale

unread,
Jan 15, 2015, 6:24:14 AM1/15/15
to seleniu...@googlegroups.com
There's a separate Chromedriver Google user group. They might know the Chrome equivalent if Google can't tell you,
Reply all
Reply to author
Forward
0 new messages