How do I get the HTML in an element using Capybara?-open source projects jnicklas/capybara

Steve

In my environment, find returns a Capybara::Element – that responds to the :native method as Eric Hu mentioned above, which returns a Selenium::WebDriver::Element (for me). Then :text gets the contents, so it could be as simple as:

results = find(:xpath, "//td[@id='#{cell_id}']")
contents = results.native.text

if you’re looking for the contents of a table cell. There’s no content, inner_html, inner_text, or node methods on a Capybara::Element. Assuming people aren’t just making things up, perhaps you get something different back from find depending on what else you have loaded with Capybara.