问题
can I get the correct data/text that is displayed via AJAX using mechanize in ruby?
Or is there any other scripting gem that would allow me to do so?
回答1:
Mechanized cannot read data displayed by JavaScript, because it does not implement a JavaScript engine (in other words, it can't run it). You'll need a browser to do that, or a program that automates a browser to do it for you. WATIR is one such program.
回答2:
You can use WATIR with webdriver which is a console only, headless browser.
来源:https://stackoverflow.com/questions/3852678/can-mechanize-read-ajax-ruby