2015-09-07 59 views
5

任何关于沉默这些capybara-webkit警告的建议?沉默不必要的水豚-webkit警告

2015年9月6日14:15:38.455 webkit_server [3700:6222738]错误加载 /用户/贾斯汀/库/互联网插件/谷歌地球网络 插件in.plugin /内容/ MacOS的/libnpgeplugin.dylib: dlopen(/ Users/justin/Library/Internet Plug-Ins/Google Earth Web Plug-in.plugin/Contents/MacOS/libnpgeplugin.dylib,265):找不到合适的 图像。插件/ Google地球网站 Plug-in.plugin/Contents/MacOS/libnpgeplugin.dylib:mach-o,但是错误 architecture plugin,NP_Initialize start plugin,NP_Initialize end 插件,NP_GetEntryPoints启动Private_Initialize 插件,NP_GetEntryPoints结束2015年9月6日14:15:38.463 webkit_server [3700:6222738]错误加载 /用户/贾斯汀/库/应用程序 支持/实/视频/ 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):没有合适的图像f ound。发现: /用户/贾斯汀/图书馆/应用程序 支持/ Facebook /视频/ 3.1.0.522/FacebookVideoCalling.webplugin /内容/ MacOS/FacebookVideoCalling: mach-o,但错误的架构2015-09-06 14:15: 38.493 webkit_server [3700:6222738]:15:38.495 webkit_server [3700:6222738]错误加载 /库/互联网插件/ QuickTime的 插件无法进行的CFBundle 0x7ffd14fcd260(非充电状态) 2015年9月6日14找到可执行文件.plugin/Contents/MacOS/QuickTime Plugin: dlopen(/ Library/Internet Plug-Ins/QuickTime Plugin.plugin/Contents/MacOS/QuickTime Plugin,265):找不到合适的图像 。找到:/ Library/Internet Plug-Ins/QuickTime Plugin.plugin/Contents/MacOS/QuickTime Plugin:mach-o,但是错误 architecture objc [3700]:Class/Adob​​ePDFFrogressView实现于 /Library/Internet Plug -Ins/Adob​​ePDFViewer.plugin/Contents/MacOS/Adob​​ePDFViewer和 /Library/Internet Plug-Ins/Adob​​ePDFViewerNPAPI.plugin/Contents/MacOS/Adob​​ePDFViewerNPAPI。 其中一个将被使用。哪一个是未定义的。 objc [3700]: 类ObjCTimerObject在两个实施/库/因特网 插件/ Adob​​ePDFViewer.plugin /内容/的MacOS/Adob​​ePDFViewer和 /库/因特网 插件/ Adob​​ePDFViewerNPAPI.plugin /内容/ MacOS的/ Adob​​ePDFViewerNPAPI 。 其中一个将被使用。哪一个是未定义的。 objc [3700]:类 MacCocoaSocketServerHelperRtc在两个实施/库/因特网 插件/ o1dbrowserplugin.plugin /内容/的MacOS/o1dbrowserplugin和 /库/因特网 插件/ googletalkbrowserplugin.plugin /内容/ MacOS的/ googletalkbrowserplugin 。 其中一个将被使用。哪一个是未定义的。

回答

5

以下是防止警告显示在控制台中的片段:https://github.com/thoughtbot/capybara-webkit/issues/157

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 

虽然这部作品隐藏的消息,我觉得修复它会防止以往任何时候都加载所加载的插件的正确方法。但我还没有想出如何与水豚和webkit做到这一点。