I am trying to scrape a website which has multiple page results like "1, 2, 3, 4, 5...". Every pagination number is a link to another page and I need to scrape every page. So far I came up with this:
while lien = page.link_with(:text=> link_number.to_s)
link_number = link_number + 1
body = page.body
html_body = Nokogiri::HTML(body)
html_body.css('#personne tbody tr').each do |person|
puts person.css('td').first.text.to_s
end
page = lien.click
end
But this never scraps the last page.
Please help me write better code that scrapes the last page.