Execute javascript in Ruby

Hello all!

I use 'net/http' lib for get and parse html pages. But I also need to
execute some javascripts on pages from my ruby-scripts like on
web-browsers. Is it possible? May be there are special libraries...
Please advise.

···

--
Posted via http://www.ruby-forum.com/.

I use 'net/http' lib for get and parse html pages. But I also need to
execute some javascripts on pages from my ruby-scripts like on
web-browsers. Is it possible? May be there are special libraries...
Please advise.

Have a look at watir[1] or even celerity[2] (on jruby).

Those will let you pretend to be a browser, GET/POST pages and run javascript just as the real browser would.

kaspar

[1] http://wtr.rubyforge.org/index.html
[2] http://celerity.rubyforge.org/doc/

Johnson embeds a JavaScript interpreter in Ruby. You might want to check that out:

···

On Sep 8, 2009, at 10:56 PM, Andrew Andreev wrote:

Hello all!

I use 'net/http' lib for get and parse html pages. But I also need to
execute some javascripts on pages from my ruby-scripts like on
web-browsers. Is it possible? May be there are special libraries...
Please advise.

---
Aaron Patterson
http://tenderlovemaking.com