在终端输出中抑制nightwatchjs的警告。

问题描述 投票:0回答:1

我正在使用nightwatchjs来运行我的测试套件,我想删除终端显示的警告信息。

目前,当我的脚本运行时,我收到了大量的警告信息(当然是真实的),这使得结果的阅读变得越来越困难。

举个例子,在我的脚本运行时,我收到了大量的(公认的)警告信息,这使得结果的阅读越来越困难。

enter image description here

是的,他们是有效的消息,但它不是经常可能让我唯一地挑选出每一个单独的元素,我对他们的输出不感兴趣。

所以,我想知道如何才能阻止它们在我的终端中被报告。

以下是我目前在我的系统中尝试过的方法 nightwatch.conf.js 配置文件。

            desiredCapabilities: {
                browserName: 'chrome',
                javascriptEnabled : true,
                acceptSslCerts: true,
                acceptInscureCerts: true,
                chromeOptions : {
                    args: [
                        '--ignore-certificate-errors',
                        '--allow-running-insecure-content',
                        '--disable-web-security',
                        '--disable-infobars',
                        '--disable-popup-blocking',
                        '--disable-notifications',
                        '--log-level=3'],
                    prefs: {
                        'profile.managed_default_content_settings.popups' : 1,
                        'profile.managed_default_content_settings.notifications' : 1
                    },
                },
            },
        },

but it's still displaying the warnings.

Any help on this would be really appreciated.

Many thanks.
node.js nightwatch.js
1个回答
0
投票

你可以尝试设置 detailed_output 属性改为false。这将阻止这些细节在控制台中打印。

你可以找到一个示例配置文件 此处.

你可以在以下栏目中找到相关细节 Output Settings 公文栏目 此处.

更新1:这看起来像是一个控制这个的属性组合,下面的组合对我来说是有效的。

  live_output: false,
  silent: true,
  output: true,
  detailed_output: false,
  disable_error_log: false,
© www.soinside.com 2019 - 2024. All rights reserved.