Hello,
I'm having a problem with WWW::Mechanize that I hope that someone more
knowledgeable than myself can help me with. I want to automate
logging on to the investopedia stock simulator web site.
http://simulator.investopedia.com/authorization/login.aspx
I can't seem to automate this successfully.
My perl script is below:
#!/usr/bin/env perl
use strict;
use Net::HTTP;
use LWP::UserAgent;
use WWW::Mechanize;
my $site="http://simulator.investopedia.com";
my $url=$site . "/authorization/login.aspx";
my $ua = WWW::Mechanize->new(autocheck => 1);
$ua->cookie_jar({});
$ua->get($url);
my $username = "XXX";
my $password = "XXX";
#$ua->credentials( $url, $username, $password );
# the login page:
#
my $page = $ua->content();
print $page;
print "DONE";
print "\n";
$ua->submit_form(
form_number => 0,
fields => {
'ctl00$MainPlaceHolder$usernameText' =>
$username,
'ctl00$MainPlaceHolder$passwordText' =>
$password,
},
);
print $ua->content();
but the resulting page I print does not
look like what I get when I manually click the submit button at all. It returns me to the login page again. I must be doing something incorrectly. Can someone with more knowledge shed some
light on my mistakes ... *ANY* hints/suggestions/directions would be very
appreciated since I've run out of ideas of things to try at this point.
Thanks very much
PS. I tried the "credentials" call with no luck either.