in reply to Mechanizing Javascript form

I'm quite sure that WWW::Mechanize works under ActiveState Perl. What did you try and how did it fail?

Automating JavaScript is best done by looking at the JavaScript and then programming the same stuff in Perl to recreate what the JavaScript does. A good thing to look at is what the browser finally sends over to the server.

If you're hell-bent on automating a browser, take a look at HTML::Display, which automates IE to display HTML.

perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web

Replies are listed 'Best First'.
Re: Re: Mechanizing Javascript form
by Roy Johnson (Monsignor) on Nov 10, 2003 at 18:36 UTC
    I'm quite sure that WWW::Mechanize works under ActiveState Perl. What did you try and how did it fail?
    I looked at http://ppm.activestate.com/BuildStatus/5.8-W.html where it lists Mechanize as a FAIL and unavailable. My proxy iswas failing to connect under PPM, so I haven't been able to test it directly but I've fixed the problem and installed Mechanize. Huzzah!
    Automating JavaScript is best done by looking at the JavaScript and then programming the same stuff in Perl to recreate what the JavaScript does. A good thing to look at is what the browser finally sends over to the server.
    That's almost surely the path I will be taking. I posted because it would be more elegant to "simply" execute the code. I couldn't find a module that said it could do that, but sometimes I miss things. Often, really. After all, there is a Javascript module, and a Mechanize module, so it isn't unimaginable...

    Thanks for your response.

      To successfully automate JavaScript, you not only need a working JavaScript virtual machine (as JavaScript.pm and Scripting::JavaScript provide, you also need the HTML DOM plus some other objects like frame, window and other weirdness, which is possible to implement, but if your only goal is to automate some web interaction, it's most likely easier to simply do the task at hand than to solve the generic problem.

      perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web