Skip to content

Instantly share code, notes, and snippets.

@masaki
Forked from cfcosta/gist:1149139
Created Sep 11, 2012
Embed
What would you like to do?
Implementation of Webrat's #table_at for using with Capybara. Not the cleanest implementation ever, but it works correctly.
def table_at(selector)
Nokogiri::HTML(page.body).css(selector).map do |table|
table.css('tr').map do |tr|
tr.css('td').map { |td| td.text.strip }
end
end[0].reject(&:empty?)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment