Calling a javascript function with Mechanize

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.

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

On Jan 3, 2008 9:24 AM, Kamal F. [email protected] 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/)

On Jan 3, 12:23 pm, Jano S. [email protected] 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?

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