Rspec 消除不必要的水豚网络工具包警告

Rspec 消除不必要的水豚网络工具包警告,rspec,capybara,capybara-webkit,Rspec,Capybara,Capybara Webkit,有没有关于消除这些水豚网络工具包警告的建议 2015-09-06 14:15:38.455 webkit_服务器[3700:6222738]加载错误 /用户/贾斯汀/图书馆/互联网插件/谷歌地球网 Plug-in.plugin/Contents/MacOS/libnpgeplugin.dylib: dlopen(/Users/justin/Library/internetplugins/googleearthweb Plug-in.plugin/Contents/MacOS/libnpgeplu

有没有关于消除这些水豚网络工具包警告的建议

2015-09-06 14:15:38.455 webkit_服务器[3700:6222738]加载错误 /用户/贾斯汀/图书馆/互联网插件/谷歌地球网 Plug-in.plugin/Contents/MacOS/libnpgeplugin.dylib: dlopen(/Users/justin/Library/internetplugins/googleearthweb Plug-in.plugin/Contents/MacOS/libnpgeplugin.dylib,265):没有合适的 找到图像。找到了:/Users/justin/Library/Internet 插件/谷歌地球网 plugin.plugin/Contents/MacOS/libnpgeplugin.dylib:mach-o,但错误 架构插件,NP_初始化开始插件,NP_初始化结束 插件,NP\u GetEntryPoints开始私有\u初始化 插件,NP_GetEntryPoints结束2015-09-06 14:15:38.463 webkit_服务器[3700:6222738]加载错误 /用户/贾斯汀/图书馆/应用程序 Support/Facebook/video/3.1.0.522/FacebookVideoCalling.webplugin/Contents/MacOS/FacebookVideoCalling: dlopen(/Users/justin/Library/Application) Support/Facebook/video/3.1.0.522/FacebookVideoCalling.webplugin/Contents/MacOS/FacebookVideoCalling, 262):未找到合适的图像。确实发现: /用户/贾斯汀/图书馆/应用程序 Support/Facebook/video/3.1.0.522/FacebookVideoCalling.webplugin/Contents/MacOS/FacebookVideoCalling: 马赫-欧,但结构错误2015-09-06 14:15:38.493 webkit_服务器[3700:6222738]找不到Cbundle的可执行文件 0x7ffd14fcd260(未加载) 2015-09-06 14:15:38.495 webkit_服务器[3700:6222738]加载错误 /图书馆/互联网插件/QuickTime Plugin.Plugin/Contents/MacOS/QuickTime插件: dlopen(/Library/Internet插件/QuickTime Plugin.Plugin/Contents/MacOS/QuickTime Plugin,265):没有合适的图像 建立未找到:/Library/Internet插件/QuickTime Plugin.Plugin/Contents/MacOS/QuickTime Plugin:mach-o,但错误 体系结构objc[3700]:类AdobePDFProgressView在中实现 两者都有/图书馆/互联网 插件/AdobePDFViewer.plugin/Contents/MacOS/AdobePDFViewer和 /图书馆/互联网 插件/AdobePDFViewerNPAPI.plugin/Contents/MacOS/AdobePDFViewerNPAPI。 将使用其中一个。哪一个是未定义的。objc[3700]:类 ObjCTimerObject在/Library/Internet中都实现 插件/AdobePDFViewer.plugin/Contents/MacOS/AdobePDFViewer和 /图书馆/互联网 插件/AdobePDFViewerNPAPI.plugin/Contents/MacOS/AdobePDFViewerNPAPI。 将使用其中一个。哪一个是未定义的。objc[3700]:类 MacCoCoCoSocketServerHelperRTC在/Library/Internet中都实现 插件/o1dbrowserplugin.plugin/Contents/MacOS/o1dbrowserplugin和 /图书馆/互联网 插件/googletalkbrowserplugin.plugin/Contents/MacOS/googletalkbrowserplugin。 将使用其中一个。哪一个是未定义的


以下是一个防止警告显示在控制台中的代码段:

Capybara::Webkit.configure do | config|
config.block\u未知\u URL#
Capybara::Webkit.configure do |config|
  config.block_unknown_urls  # <--- this configuration would be lost if you didn't use .merge below
end

class WebkitStderrWithQtPluginMessagesSuppressed
  IGNOREABLE = Regexp.new( [
    'CoreText performance',
    'userSpaceScaleFactor',
    'Internet Plug-Ins',
    'is implemented in bo'
  ].join('|') )

  def write(message)
    if message =~ IGNOREABLE
      0
    else
      puts(message)
      1
    end
  end
end

Capybara.register_driver :webkit_with_qt_plugin_messages_suppressed do |app|
  Capybara::Webkit::Driver.new(
    app,
    Capybara::Webkit::Configuration.to_hash.merge(  # <------ maintain configuration set in Capybara::Webkit.configure block
      stderr: WebkitStderrWithQtPluginMessagesSuppressed.new
    )
  )
end

Capybara.javascript_driver = :webkit_with_qt_plugin_messages_suppressed