You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
require 'rubygems'
require 'mechanize'
agent=Mechanize.new
agent.user_agent='wget' # default user-agent string is banned apparantly
page=agent.get('http://en.wikipedia.org/wiki/Comparison_of_file_archivers')
page.search('table.wikitable:first-child') #does not work
page.search('.wikitable:first-child') #does not work
page.search('table:first-child') #works - but it's not a .wikitable table
page.search('table.wikitable') #works - returns 5 tables
The error is:
> page.search('table.wikitable:first-child')
RuntimeError: xmlXPathCompOpEval: function first-child not found
from /usr/lib/ruby/gems/1.8/gems/nokogiri-1.4.0/lib/nokogiri/xml/node.rb:142:in `evaluate'
from /usr/lib/ruby/gems/1.8/gems/nokogiri-1.4.0/lib/nokogiri/xml/node.rb:142:in `xpath'
from /usr/lib/ruby/gems/1.8/gems/nokogiri-1.4.0/lib/nokogiri/xml/node.rb:139:in `map'
from /usr/lib/ruby/gems/1.8/gems/nokogiri-1.4.0/lib/nokogiri/xml/node.rb:139:in `xpath'
from /usr/lib/ruby/gems/1.8/gems/nokogiri-1.4.0/lib/nokogiri/xml/node.rb:106:in `search'
from (irb):119
from /usr/local/lib/site_ruby/1.8/rubygems.rb:168
RuntimeError: xmlXPathCompOpEval: function first-child not found
from /usr/lib/ruby/gems/1.8/gems/nokogiri-1.4.0/lib/nokogiri/xml/node.rb:142:in `evaluate'
from /usr/lib/ruby/gems/1.8/gems/nokogiri-1.4.0/lib/nokogiri/xml/node.rb:142:in `xpath'
from /usr/lib/ruby/gems/1.8/gems/nokogiri-1.4.0/lib/nokogiri/xml/node.rb:139:in `map'
from /usr/lib/ruby/gems/1.8/gems/nokogiri-1.4.0/lib/nokogiri/xml/node.rb:139:in `xpath'
from /usr/lib/ruby/gems/1.8/gems/nokogiri-1.4.0/lib/nokogiri/xml/node.rb:106:in `search'
from (irb):119
from /usr/local/lib/site_ruby/1.8/rubygems.rb:168
Using Mechanize 1.0.0.
The text was updated successfully, but these errors were encountered:
The error is:
Using Mechanize 1.0.0.
The text was updated successfully, but these errors were encountered: