I'm trying to create a script to log into a JSP website using LWP (Library for WWW in Perl) and perform several actions. The website has some Ajax Elements (Widgets) That are rendered after logging in. I am able to get the frames with this code however the Ajax widgets fail to load.
#!/usr/bin/perl
use strict;
use warnings;
use LWP::Simple;
use LWP::UserAgent;
use HTTP::Request::Common qw(POST);
use HTTP::Cookies;
my $ua = LWP::UserAgent->new;
$ua->agent('Mozilla/8.0');
$ua->cookie_jar(
HTTP::Cookies->new(
file => 'mycookies.txt',
autosave => 1
)
);
push @{ $ua->requests_redirectable } , 'POST';
$ua->max_redirect('3');
my $user="USER";
my $psw="PASSWORD";
my $req = POST 'http://somesite.../?cmd=login', ['userid'
=> $user , 'pwd' => $psw];
my $res = $ua->request($req);
if ($res->is_success){
print $res->content;}else { print $res->status_line . "
" . $res->content;}
exit 0;
I tried CURL and that failed in Ajax parts too. Can anyone help ? Is there any tools out there that does this ? [I've been told I need to create a virtual browser, but other than curl and lwp I dunno how ]