Last Updated: February 07, 2017
·
29.32K
· dsci

Print the current page's html source in Capybara

To get the HTML source of Cucumbers current location there are several ways:

To get the whole HTML source in STDOUT:

print page.html

To get the HTML body in STDOUT:

print bage.body

To get the current location in the browser:

save_and_open_page

For the last solution launchy is required:

group :test do
   gem 'launchy'
end

1 Response
Add your response

Nice write-up! I think you have a typo, though... print bage.body should be print page.body

over 1 year ago ·