http://www.perlmonks.org?node_id=970968

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

Hi guys,

I am using WWW::Mechanize to automate a script on the amazon page. However i am not even able to sign into the page using WWW::Mechanize. The url link. is where the form is. How would i use mechanize to log into this page.

My code:
use WWW::Mechanize; my $mech = WWW::Mechanize->new(); $mech->get("https://www.amazon.com/gp/css/homepage.html/"); $mech->submit_form( form_name => 'yaSignIn', fields => { 'email' => $email, 'password' => $password, }, ); print $mech->content();
The output of mech dump is as follows.
POST https://www.amazon.com/gp/flex/sign-in/select.html [yaSignIn] useRedirectOnSuccess=1 (hidden readonly) path=/gp/css/homepage.html (hidden readonly) action=sign-in (hidden readonly) protocol=https (hidden readonly) email= (text) password= (password) <NONAME>=Sign In (submit)
The html for sumbitting a form
<input width="201" type="image" height="22" border="0" align="absmiddl +e" id="submit" value="Continue" alt="sign in using our secure server" + src="https://images-na.ssl-images-amazon.com/images/G/01/x-locale/co +mmon/buttons/sign-in-secure._V192194766_.gif">
When i save the output to file it says please enable cookies to continue.