any idea how I can pass correct argument to xpath? There must be something about how to use single/double quotes. When I use variable
parser_xpath_identificator = "'//table/tbody[@id=\"threadbits_forum_251\"]/tr'"
gives me an incorrect value or
parser_xpath_identificator = "'//table/tbody[@id="threadbits_forum_251"]/tr'"
gives me an error syntax error, unexpected tIDENTIFIER, expecting $end
require 'rubygems'
require 'mechanize'
parser_xpath_identificator = "'//table/tbody[@id=\"threadbits_forum_251\"]/tr'"
# parser_xpath_identificator = "'//table/tbody[@id="threadbits_forum_251"]/tr'"
#gives an error: syntax error, unexpected tIDENTIFIER, expecting $end
agent = WWW::Mechanize.new
page = agent.get("http://www.vbulletin.org/forum/index.php")
page = page.link_with(:text=>'vB4 General Discussions').click
puts "Page title: #{page.title}"
puts "\nfrom variable: #{page.parser.xpath(parser_xpath_identificator).length}"
puts "directly: #{page.parser.xpath('//table/tbody[@id="threadbits_forum_251"]/tr').length}"