How can I see what capybara found in a failing cucumber step?

ajmurmann picture ajmurmann · Mar 10, 2010 · Viewed 25.6k times · Source

I started migrating from cucumber + webrat to cucumber + capybara. Now the behavior of "I should see " seems to be somewhat different. Most of these fail now, although I didn't change anything on the page. I replaced the snippet that should be found with some stuff that is on every page and for some text it works and for other text it doesn't. I can't find any pattern in what is found in the page's content and what is not. Webrat used to print what the page content is that it found, in case it did not contain the required phrase. Is there anyway to have capybara show what text it got from the page in which it tried to find the text?

Answer

sent-hil picture sent-hil · Feb 13, 2011

Then show me the page calls webrat/capybara's underlying save_and_open_page method. Found that useful when working with steak.