Prompt_for_download is still appearing after setti

2019-02-18 07:13发布

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条回答
一纸荒年 Trace。
2楼-- · 2019-02-18 07:51

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:

查看更多
登录 后发表回答