如何使用Capybara和RSpec检查会话哈希? [英] How to inspect the session hash with Capybara and RSpec?
本文介绍了如何使用Capybara和RSpec检查会话哈希?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Stack Overflow上找到了关于此的各种帖子,但没有找到解决方案.
Found various posts about this on Stack Overflow, but didn't find a solution.
在集成测试中,如何使用Capybara和RSpec检查会话哈希?
From within an integration test, how to inspect the session hash with Capybara and RSpec?
puts session.inspect
引发undefined method for nil
错误.
推荐答案
Based on your comment you need debugging so you can use:
save_and_open_page
拍摄页面快照并对其进行查看,或者您可以使用:
to take a snapshot of a page and take a look at it, or you can use:
print page.html
如果要以字符串形式检索DOM的当前状态
if you want to retrieve the current state of the DOM as a string
来源:水豚调试
这篇关于如何使用Capybara和RSpec检查会话哈希?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文