Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can any of Ruby's HTML Parsers do JavaScript to see the resulting DOM?

When trying Hpricot and Nokogiri, the HTML can be fetched and parsed, but can they also execute the Javascript as well so that the content shows on the page? (shows up in the the DOM). That's because some page won't show the info unless the JavaScript initialization code has run.

like image 515
nonopolarity Avatar asked Sep 05 '10 19:09

nonopolarity


2 Answers

Not that I know of. You might want to look into using something like Watir and use a real browser.

like image 194
AboutRuby Avatar answered Sep 22 '22 17:09

AboutRuby


Take a look at envjs and johnson gems.

like image 38
antage Avatar answered Sep 22 '22 17:09

antage