Discussion Forums
Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
- Topic List
- Most Recent Posts
- Sign In for more options
How do I get the HTML in an element using Capybara?
2 Posts
How do I get the HTML in an element using Capybara?
I'm writing a cucumber test where I want to get the HTML in an element.
For example:
within 'table' do
# this works
find('//tr[2]//td[7]').text.should == "these are the <b>comments</b>"
# I want something like this (there is no "html" method)
find('//tr[2]//td[7]').html.should == "these are the <b>comments</b>"
end
Anyone know how to do this?
Try this:
page.has_xpath?("//tr[2]//td[@class='comments' and contains(string(), 'these are the comments')]").should true
I can't figure it out how to access the seventh
2 Posts
