Re: Javascript and WWW::Mechanize or LWP::UserAgent?
deborah sciales <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.lwp |
|---|---|
| Message-ID | <[email protected]> |
You might also try writing your own javascript parsing routines?
my $mech = WWW::Mechanize->new();
$mech->get("blah.html");
use some method in some way
if (my $result = do_something($mech)){#do something}
then in some method
sub do_something {
my $mech = shift;
my $blah;
my $stream = HTML::TokeParser->new(\$mech->{content});
#use tokeparser or even treebuilder
return $blah;
}
Or maybe you could add javascript parsing routines to WWW::Mechanize and
submit a patch?
I don't know enough about your particular problem....
John J Lee wrote:
>On Mon, 11 Jul 2005, Warren Pollans wrote:
>
>
>
>>I've been using WWW::Mechanize to automate testing of cgi scripts -
>>works great!
>>
>>The problem I'm running into is "trying to deal with scripts that use
>>javascript" - so far, I've had to ignore them or, at least, those
>>
>>
>[...]
>
>
>>I really like being able to test from my unix box instead of having to
>>find a windows box to run quicktest pro or winrunner on.
>>
>>
>
>Try Selenium instead of mechanize. Not ideal for scraping (you have to
>drag in the entire browser, including its GUI, to use it, and the "driven"
>mode is currently buggy), but good for functional testing. Written in
>cross-browser JavaScript (in good OO style, too).
>
>http://selenium.thoughtworks.com/
>
>
>It's quite new, but it's the only free tool in its class (cross-browser
>playback of functional tests) that I know of. With any luck, somebody may
>write a decent test recorder for it too (ie. record a test simply by doing
>what you'd do if you were manually testing -- ATM there are HTTP-proxying
>test recorders that try and do this, but one written in JS is what's
>really needed).
>
>
>John
>
>
>
>