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
Written by Daniel Schmidt
Related protips
1 Response
Nice write-up! I think you have a typo, though... print bage.body
should be print page.body
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Rails
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#