From: 7stud -- Date: 2012-12-12T16:09:25+09:00 Subject: Re: Mechanize problem. The problem is that when you view the page in your browser, your browser executes some javascript code that sets the value of the counter
. However, when you use mechanize to access the page, mechanize retrieves a text file containing the lines of javascript code as well as the html--but mechanize is not a browser, so it cannot execute the javascript code (nor does mechanize display the colors specified by the html). All mechanize does is examine the text file for information. Luckily for you, there are now advanced programs that can retrieve the text file containing the javascript and html, load the file into a browser(which executes the javascript), then the program can examine what is actually displayed in the browser: require 'watir-webdriver' b = Watir::Browser.new b.goto("http://www.linasmatkasse.se") counter_div = b.div id: 'counter' puts counter_div.text --output:-- 26 308 814 -- Posted via http://www.ruby-forum.com/.