Forum: Ruby calling a javascript function with Mechanize

99f789e5ec91bcc6e8cc8404efe6d856?d=identicon&s=25 Rita Amritkar (ritz_amritkar)
on 2008-01-03 08:56
(Received via mailing list)
Hi all,

       I am using Mechanize. I can get the particular contents but I
am not getting the expected data. There is a function in javascript
as,
window.onload = function() {
        if (location && location.search == "") {
          location.replace('/po3/?_d');
        } else {
          location.replace('/po3/' + location.search + '&_d=1');
        };
      };

I think this function is not getting called so I am not able to get
the expected data. I want to call this function with Mechanize.

Please help me...

Thanks in advance.
0cbb8bf6889de00150ddf9ac3062199b?d=identicon&s=25 Kamal Fariz (Guest)
on 2008-01-03 09:25
(Received via mailing list)
> There is a function in javascript
>
> snip
>
> I think this function is not getting called so I am not able to get
> the expected data. I want to call this function with Mechanize.

Mechanize can't evaluate javascript. The creator of Mechanize, Aaron
Patterson, is working on a new project called RKelly which has the
goal of being able to evaluate Javascript in Ruby.

Until then, your only solution is to use Selenium or Watir to control
an actual browser.

Regards,
Kamal
97550977337c9f0a0e1a9553e55bfaa0?d=identicon&s=25 Jano Svitok (Guest)
on 2008-01-03 12:25
(Received via mailing list)
On Jan 3, 2008 9:24 AM, Kamal Fariz <kamal@ror.com.my> wrote:
>
> Until then, your only solution is to use Selenium or Watir to control
> an actual browser.

IIRC scrubyt uses firewatir for similar cases, so you may have better
luck using that. (http://scrubyt.org/)
E41c5c2562a8eccb023acb6e14b22cc0?d=identicon&s=25 ilpuccio.febo@gmail.com (Guest)
on 2008-01-04 11:15
(Received via mailing list)
On Jan 3, 12:23 pm, Jano Svitok <jan.svi...@gmail.com> wrote:
> > Patterson, is working on a new project called RKelly which has the
> > goal of being able to evaluate Javascript in Ruby.
>
> > Until then, your only solution is to use Selenium or Watir to control
> > an actual browser.

Take a look here:
http://code.google.com/p/ruby-spidermonkey/
would be very interesting binding javascript engine directely in ruby.

> IIRC scrubyt uses firewatir for similar cases, so you may have better
> luck using that. (http://scrubyt.org/)
Can you point me on that kind of example, plz?
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.