rshf / chromedriver

Automatically exported from code.google.com/p/chromedriver
2 stars 1 forks source link

Receiving a message 'This site is attempting to download multiple files. Do you want to allow this?' when using the ChromeDriver 22 #130

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Navigate to a page that has multiple files
2. Attempt to download several files
3. See the message
4. This message is apparently modal, as my test scripts cannot proceed past 
this point.

So, yes, the test script is attempting to download multiple files, but all 
downloads are triggered by individual clicks from the test script.

What version of the product are you using? On what operating system?
ChromeDriver = 22.0.1203.0
Chrome = 21.0.1180.60
OS = Windows 7

Please attach chromedriver.log to your bug report if possible.

Original issue reported on code.google.com by ckret...@umich.edu on 3 Aug 2012 at 3:37

Attachments:

GoogleCodeExporter commented 9 years ago
How are you attempting to download the file? For me, attempting to download 
multiple files causes an infobar to appear, which cannot be handled by 
chromedriver. However, this doesn't freeze my test.

Original comment by kkania@chromium.org on 9 Aug 2012 at 11:56

GoogleCodeExporter commented 9 years ago
Each file is represented by a link, which the test script 'clicks'.  This 
directs Chrome to download the file to the default download location.

I am using a keyword framework built on top of the webdriver, so I don't have a 
script to show you, per se.  Essentially the operative lines of code are thus:

// This line works correctly, it grabs a webElement corresponding to an xpath.
clickThing = driver.findElement(byXpath("//a[normalize-space()='test.doc']");
// This line clicks on this xpath.  Also works correctly in the sense that it 
is clicking on the element in question.  This is what causes the infobar to 
appear.
clickThing.click()

I do not get that infobar when I perform the same action manually.  Also, I was 
not getting this same issue until roughly 10 days ago.  I don't know if it was 
the release of Chrome 21 or ChromeDriver 22.  I have been using the 
ChromeDriver for roughly 12 months without issue before this.

Let me know if you need anymore detail.

ck

Original comment by ckret...@umich.edu on 10 Aug 2012 at 2:17

GoogleCodeExporter commented 9 years ago
I am having the same issue.  Do we have a workaround?

Original comment by alvinl...@gmail.com on 5 Nov 2012 at 11:21

GoogleCodeExporter commented 9 years ago
Same problem trying to do an automated test with webdriver.

Original comment by jpd...@gmail.com on 31 Jan 2013 at 2:08

GoogleCodeExporter commented 9 years ago
Still no fix for this?

Original comment by Alejan...@nimbic.com on 31 Jan 2013 at 11:37

GoogleCodeExporter commented 9 years ago
Same problem here, related to: 
https://code.google.com/p/chromium/issues/detail?id=166335

Original comment by jpd...@gmail.com on 31 Jan 2013 at 11:38

GoogleCodeExporter commented 9 years ago

Original comment by kkania@chromium.org on 13 Mar 2013 at 11:55

GoogleCodeExporter commented 9 years ago

Original comment by kkania@chromium.org on 14 Mar 2013 at 9:20

GoogleCodeExporter commented 9 years ago

Original comment by kkania@chromium.org on 14 Mar 2013 at 9:21

GoogleCodeExporter commented 9 years ago

Original comment by kkania@chromium.org on 14 Mar 2013 at 10:09

GoogleCodeExporter commented 9 years ago
I am also seeing this issue with ChromeDriver2. Please provide info if there is 
some workaround for it

Original comment by lkumarbl...@gmail.com on 15 Apr 2013 at 12:53

GoogleCodeExporter commented 9 years ago
Hello,
It seems I have found work-around.
Start ChromeDriver with the following option:

options.prefs = new Dictionary<string, object>
{
    { "profile.content_settings.pattern_pairs.*.multiple-automatic-downloads", 1 }
};

Original comment by St.Zele...@gmail.com on 21 Oct 2013 at 3:28

Attachments:

GoogleCodeExporter commented 9 years ago
Guys, there is a simple way to fix this problem if you don't want to see this 
asking bar again, click the setting and unhide the "Privacy content settings" 
and scroll to the bottom you will then see automatic downloads, select allow 
.... Bingo...
No more annoying messages...

Original comment by zuesshi...@gmail.com on 16 Nov 2013 at 1:59

GoogleCodeExporter commented 9 years ago
To zuesshi: As far as I understand, each time WebDriver starts browser with 
default settings (new profile). So the manipulations described by you will not 
work.

Original comment by St.Zele...@gmail.com on 18 Nov 2013 at 2:14

GoogleCodeExporter commented 9 years ago
i don't have that option on chromium for debian..

Original comment by Axel.lam...@gmail.com on 6 Jan 2014 at 6:50

GoogleCodeExporter commented 9 years ago
I had some luck with a version of #12:
As outlined in the ChromeDriver documentation 
(https://sites.google.com/a/chromium.org/chromedriver/capabilities) I used:

ChromeOptions options = new ChromeOptions(); 
Map<String, Object> prefs = new HashMap<String, Object>();
//Turns off multiple download warning
prefs.put( 
"profile.content_settings.pattern_pairs.*.multiple-automatic-downloads", 1 );
//Turns off download prompt
prefs.put("download.prompt_for_download", false);

Thanks for the help!

Original comment by d...@paloalto.com on 12 Apr 2014 at 7:23

GoogleCodeExporter commented 9 years ago
I faced "multiple file downloads" issue while generating excel reports in our 
application using chrome. I tried above mentioned solutions but failed. I used 
"driver.navigate().refresh();" as a workaround which worked like a charm in my 
case. 

Original comment by immadise...@gmail.com on 19 Jun 2014 at 4:12

GoogleCodeExporter commented 9 years ago
            opts = ChromeOptions()
            multi_dl_prefs = {}
            multi_dl_prefs['profile.default_content_settings.multiple-automatic-downloads'] = 1
            opts.add_experimental_option("prefs", multi_dl_prefs)

Original comment by jxzrob...@gmail.com on 25 Jul 2014 at 4:46

GoogleCodeExporter commented 9 years ago
Even i am facing this problem:

I am using:
Chrome Version= 37.0.2062.124 
Chrome Driver= Chrome Driver 2.9
OS = Windows 7 Professional 32 bit
Selenium Java bindings: 2.42.2
I tried all above solutions ,but no luck nothing is working.
I cannot use browser refresh this makes application log out.
If anybody have any other solutions, please post your solution.

Thanks,
Rajendra Prasad Reddy P  

Original comment by rajendra...@gmail.com on 1 Oct 2014 at 10:11

GoogleCodeExporter commented 9 years ago
Hello,

We have case where we need to click on two links in order to download 2 files, 
and we need those two files to continue testing.

Here is how we did it:
Execute javascript to change URL a bit because chrome is detecting that you are 
trying to download from same URL multiple files and if you change URL it will 
let you do the download.

So, before download execute javascript which will add hash tag + some string at 
the end of URL and won't reload your page 

String randomstring = generate random string as you wish;

WebDriver driver = new ChromeDriver();

    if (driver instanceof JavascriptExecutor) {
        ((JavascriptExecutor) driver).executeScript("window.location='#" + randomstring +"'"");
    }

here you click on download.

Hope this helps.

Original comment by mjevto...@emisia.net on 31 Oct 2014 at 4:13

GoogleCodeExporter commented 9 years ago
thanks, the easiest and best option adviced :)

Original comment by sandule...@gmail.com on 13 Jan 2015 at 11:36

GoogleCodeExporter commented 9 years ago

Original comment by samu...@chromium.org on 21 Feb 2015 at 12:18

GoogleCodeExporter commented 9 years ago
#16 - Worked for me.
Thanks

Original comment by nikhil...@gmail.com on 2 Mar 2015 at 11:07