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.

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/

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.

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

https://github.com/jbarnette/johnson


Aaron P.
http://tenderlovemaking.com

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs