[Solved] Parse HTML nodes using xpath to Ruby/Nokogiri


I have just tried with Capybara with Poltergeist; it worked fine. When I tried your code as well but, div[@id="NavFrame1"] does not exist. So there might be a parsing problem…

require 'capybara'
require 'capybara/dsl'
require 'capybara/poltergeist'

Capybara.register_driver :poltergeist_debug do |app|
  Capybara::Poltergeist::Driver.new(app, inspector: true)
end

Capybara.javascript_driver = :poltergeist_debug
Capybara.current_driver = :poltergeist_debug 

visit("https://pt.wiktionary.org/wiki/fazer")   
doc = Nokogiri::HTML.parse(page.html)

p sequence = doc.xpath('//*[@id="NavFrame1"]/div[2]/table[2]/tbody/tr[12]')

solved Parse HTML nodes using xpath to Ruby/Nokogiri