jus*_*don 5 rspec capybara capybara-webkit
有关沉默这些capybara-webkit警告的任何建议?
2015-09-06 14:15:38.455 webkit_server [3700:6222738]加载错误/ Users/justin/Library/Internet Plug-Ins/Google Earth Web Plug-in.plugin/Contents/MacOS/libnpgeplugin.dylib:dlopen(/ Users/justin/Library/Internet Plug-Ins/Google Earth Web Plug-in.plugin/Contents/MacOS/libnpgeplugin.dylib,265):找不到合适的图像.找到了:/ Users/justin/Library/Internet Plug-Ins/Google Earth Web Plug-in.plugin/Contents/MacOS/libnpgeplugin.dylib:mach-o,但错误的架构插件,NP_Initialize启动插件,NP_Initialize end插件,NP_GetEntryPoints启动Private_Initialize插件,NP_GetEntryPoints结束2015-09-06 14:15:38.463 webkit_server [3700:6222738]加载错误/ Users/justin/Library/Application 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):找不到合适的图像.找到了:/ Users/justin/Library/Application Support/Facebook/video/3.1.0.522/FacebookVideoCalling.webplugin/Contents/MacOS/FacebookVideoCalling:mach-o,但是架构错误2015-09-06 14:15:38.493 webkit_server [ 3700:6222738]无法找到CFBundle 0x7ffd14fcd260的可执行文件(未加载)2015-09-06 14:15:38.495 webkit_server [3700:6222738]加载错误/库/ Internet插件/ QuickTime Plugin.plugin/Contents/MacOS/QuickTime插件:dlopen(/ Library/Internet Plug-Ins/QuickTime Plugin.plugin/Contents/MacOS/QuickTime Plugin,265):找不到合适的图像.找到了:/ Library/Internet Plug-Ins/QuickTime插件.插件/内容/ MacOS/QuickTime插件:mach-o,但错误的架构objc [3700]:类AdobePDFProgressView在/ Library/Internet Plug-Ins/AdobePDFViewer.plugin/Contents/MacOS/AdobePDFViewer和/ Library/Internet Plug中实现-INS/AdobePDFViewerNPAPI.plugin /内容/ MacOS的/ AdobePDFViewerNPAPI.将使用两者之一.哪一个未定义.objc [3700]:类ObjCTimerObject在/ Library/Internet Plug-Ins/AdobePDFViewer.plugin/Contents/MacOS/AdobePDFViewer和/ Library/Internet Plug-Ins/AdobePDFViewerNPAPI.plugin/Contents/MacOS/AdobePDFViewerNPAPI中实现.将使用两者之一.哪一个未定义.objc [3700]:类MacCocoaSocketServerHelperRtc在/ Library/Internet Plug-Ins/o1dbrowserplugin中实现.插件/内容/ MacOS/o1dbrowserplugin和/ Library/Internet Plug-Ins/googletalkbrowserplugin.plugin/Contents/MacOS/googletalkbrowserplugin.将使用两者之一.哪一个未定义.
这是一个片段,用于防止警告出现在控制台中: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
Run Code Online (Sandbox Code Playgroud)
虽然这可以隐藏消息,但我觉得修复它的正确方法是防止加载插件.但我还没想出如何用Capybara和webkit做到这一点.
归档时间: |
|
查看次数: |
518 次 |
最近记录: |