7

I have this below config and already set prompt_for_download to false but for some reason, when I run the test, prompt for download dialogue is keep appearing. Am I doing something wrong?

For download code, I'm following solution from here and ChromeDriver 2.14.

Thanks.

capabilities: {
    'browserName': 'chrome',
    'chromeOptions': {
        args: ['--lang=en', '--start-maximized'],
        prefs: {
            'download': {
                'prompt_for_download': false,
                'default_directory': '/tmp/downloads',
            },

        },

    },
},

1 Answer 1

14

I think you also need to add directory_upgrade:

prefs: {
    download: {
        prompt_for_download: false, 
        directory_upgrade: true,
        default_directory: '/tmp/downloads'
    },
},

Aside from that, make sure /tmp/downloads directory exists and there are permissions to write into it. Also see a similar issue:

10
  • thanks for your @alecxe. I updated as per your solution and I'm still stuck at prompt to download dialogue. Full permission given to the directory. Anything else that I should check? Thanks. Commented Mar 5, 2015 at 21:32
  • @user2388556 two question: do you see the browser starting maximized (just checking whether the options are actually applied)? Also, is this a public site (so that I can also reproduce the problem)?
    – alecxe
    Commented Mar 5, 2015 at 22:25
  • @user2388556 also try changing the default_directory path to your home directory and see if it helps or not.
    – alecxe
    Commented Mar 5, 2015 at 22:26
  • browser is maximizing and it's downloading now. Just got the hint from your home directory then I realised that my directory is in D with my project file. So path that I set in my config doesn't exist in C drive where chrome is running and I went to create "/tmp/" on C. It's downloading now but it's still failing and says "data.json - Failed - Path too long" Commented Mar 5, 2015 at 22:42
  • 1
    @user2388556 good progress! I think the answer has actually helped to solve the problem described in the question. As for you last problem, try to set the path using backslashes.
    – alecxe
    Commented Mar 5, 2015 at 22:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.