Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am hoping a monk here can help me figure out what is going around with this fairly short login script. I'm trying to log in to http://www.justanswer.com/login.asp . There is a email and password field AND a radio button which must be set to 'returning' since I already have an account. The below script keeps coming back as if I never set the radio button saying I'm a user. The mech->content test print out shows my email filled out but the radio button isn't pushed. Can you see what I may be doing wrong? The relevant HTML code from what I can see is..
<form name="aspnetForm" method="post" action="/account/sign-in.asp +x" id="aspnetForm"> <input class="JA_field" type="text" id="JA_email" name="email" maxlen +gth="75" value="" tabindex="1" /> <input class="JA_field" type="password" id="JA_password" name="passwor +d" maxlength="75" tabindex="5" /> <input class="JA_radio" type="radio" id="JA_returning" name="sign_in_ +type" value="returning" tabindex="3" checked="checked"/>
My code is below.
use WWW::Mechanize; my $email = ''; my $password = ''; my $ja_login = 'http://www.justanswer.com/login.asp'; my $answer_page = 'http://www.justanswer.com/expert/question-list.aspx +'; my $confirm_signon = 'My Questions'; print header, start_html("JA"); my $mech = WWW::Mechanize->new(agent => 'InternetExplorer 8'); my $login_get = $mech->get($ja_login); $mech->submit_form( form_name => 'aspnetForm', fields => { email => $email, password => $password, sign_in_type => 'returning',}, ); if ($mech->content !~ m/$confirm_signon/) { print "Failed to sign on"; print $mech->content; exit; } $mech->get($answer_page); print $mech->content;

Replies are listed 'Best First'.
Re: WWW::Mechanize won't sign me in
by Anonymous Monk on May 26, 2011 at 11:20 UTC