我正在寫一個黃瓜測試,我想在元素中獲取HTML。如何在使用水豚的元素中獲取HTML?
例如:
within 'table' do
# this works
find('//tr[2]//td[7]').text.should == "these are the comments"
# I want something like this (there is no "html" method)
find('//tr[2]//td[7]').html.should == "these are the <b>comments</b>"
end
任何人都知道如何做到這一點?
沒有評論方法...試圖做到這一點:'find('// tr [2] // td [10]')。content' – 2010-11-05 12:32:07
你可以發佈你的實際步驟嗎?看看你在這裏做什麼會很有幫助。我已經完成了page.find(...)並提到了Nokogiri文檔來解析響應。也許我只是幸運......請注意,我說page.find。我認爲Capybara提供了Webrat提供響應對象的頁面對象。 – 2010-11-05 17:28:57
該步驟的內容位於原始文章中。 – 2010-11-12 14:38:25