在 prefs 中设置 false 后 Prompt_for_download 仍然出现 [英] Prompt_for_download is still appearing after setting false in prefs

查看:24
本文介绍了在 prefs 中设置 false 后 Prompt_for_download 仍然出现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在下面有这个配置并且已经将 prompt_for_download 设置为 false 但是由于某种原因,当我运行测试时,提示下载对话框不断出现.难道我做错了什么?

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?

对于下载代码,我正在关注这里的解决方案和ChromeDriver 2.14.

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

谢谢.

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

        },

    },
},

推荐答案

我觉得你还需要添加directory_upgrade:

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

除此之外,请确保 /tmp/downloads 目录存在并且有写入权限.另见类似问题:

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

这篇关于在 prefs 中设置 false 后 Prompt_for_download 仍然出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆